Replaced try/catch with a callback

Done this to follow ws error-handling best practices (see https://github.com/einaros/ws/blob/master/README.md).