add socket error listener to prevent exception

if there's no listener an exception is thrown (default node EventEmitter
behavior)
catch malformed JSON exceptions

JSON.parse is known to throw exceptions, it's necessary to catch them
Merge pull request #25 from galambalazs/master

Catch socket errors and JSON.parse exceptions