Comparing version 0.4.1 to 0.5.0
@@ -132,5 +132,5 @@ (function(root, factory) { | ||
// ### HelpEsb.Client.rpcReceive | ||
// Listen on the given group like [on](#helpesb-client-on), and call the | ||
// given callback with any messages. The value returned by the callback is | ||
// sent to the GROUPNAME-result group in reply to the incoming message. | ||
// Listen on the given group like **on**, and call the given callback with | ||
// any messages. The value returned by the callback is sent to the | ||
// GROUPNAME-result group in reply to the incoming message. | ||
// | ||
@@ -168,8 +168,4 @@ // Automatically subscribes to the group for you if not already subscribed. | ||
// Catch thrown errors so that we can send the result through the ESB. | ||
var result = null; | ||
try { | ||
result = Promise.resolve(cb(data)); | ||
} catch(e) { | ||
result = Promise.reject(e.toString()); | ||
if (typeof incomingMeta.session !== 'undefined') { | ||
meta.session = incomingMeta.session; | ||
} | ||
@@ -185,7 +181,9 @@ | ||
result.then(function(data) { | ||
Promise.try(cb.bind({}, data, incomingMeta)).then(function(data) { | ||
return sendToAll(_.extend({result: 'SUCCESS'}, meta), data); | ||
}.bind(this)).catch(function(error) { | ||
var reason = error instanceof Error ? error.toString() : error; | ||
return sendToAll( | ||
_.extend({result: 'FAILURE', reason: error}, meta), | ||
_.extend({result: 'FAILURE', reason: reason}, meta), | ||
data | ||
@@ -192,0 +190,0 @@ ); |
{ | ||
"name": "help-esb", | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"description": "A client for the Help.com team's ESB.", | ||
@@ -5,0 +5,0 @@ "main": "help-esb.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23056
375