Naive question regarding error object

#1

Hi,

When throwing errors using whenjs I always end up passing everything into err.args[0].

Example:
authresult.reject({‘errormsg’: ‘ERROR! That user does not exist’});

``

Any idea what the syntax would be for ‘reject’ to populate kwargs instead?

Rgds,
Reda

0 Likes

#2

You should just throw exceptions (not “manually” reject a promise).

To send a WAMP error with kwargs, just do:

throw new autobahn.Error(‘com.myapp.error’, [‘fuck’], {a: 23, b: 9});

https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/wamp/basic/rpc/errors/backend.js

···

Am Donnerstag, 11. Dezember 2014 23:20:49 UTC+1 schrieb reda...@gmail.com:

Hi,

When throwing errors using whenjs I always end up passing everything into err.args[0].

Example:
authresult.reject({‘errormsg’: ‘ERROR! That user does not exist’});

``

Any idea what the syntax would be for ‘reject’ to populate kwargs instead?

Rgds,
Reda

0 Likes