change error event to failed

.connect() callback handler looks for `failed` event. But we fire `error` event. 
This is the fix.
Merge pull request #41 from arunoda/master

change error event to failed