SEAPUNK / socketeer

yet another websocket framework
MIT License
3 stars 0 forks source link

Action/event error handling #50

Open SEAPUNK opened 8 years ago

SEAPUNK commented 8 years ago

After some thinking, I realized that it might not be desirable to emit an 'error' event for all action errors, as some can be due to the client sending bad data, and so forth.

When should action errors emit an 'error' event? Should they ever? Should they emit 'action-error' instead? Should there be a special rejection handler for actions that knowingly refuse the action request (something along the lines of HTTP 400)? I don't want actions or events errors to fall into the nether.

SEAPUNK commented 8 years ago

I will emit an error if the calls to the action function fail, or if it does not return a Promise. Otherwise, any errors caught with actions and events will emit action-error and event-error, respectively.

SEAPUNK commented 8 years ago

Will land in 0.8.3.