Skip to content

Commit

Permalink
Trap error from RPC callback rather than calling callback with its ow…
Browse files Browse the repository at this point in the history
…n error (#9216)

* Trap error from RPC callback rather than calling callback with its own error

* add the actual error that occurred in the handler to the output

* use qx.core.Object's error() method instead of console's

* There was already a variable holding the context. Use it instead of a new one.

* for consistency, use qx.lang.Json instead of the natic JSON object, for now
  • Loading branch information
derrell authored and level420 committed Oct 24, 2016
1 parent 6effc50 commit b24911f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion framework/source/class/qx/io/remote/Rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,19 @@ qx.Class.define("qx.io.remote.Rpc",
break;

case 1: // async with handler function
handler(result, ex, id);
try
{
handler(result, ex, id);
}
catch(e)
{
eventTarget.error(
"rpc handler threw an error:" +
" id=" + id +
" result=" + qx.lang.Json.stringify(result) +
" ex=" + qx.lang.Json.stringify(ex),
e);
}
break;

case 2: // async with event listeners
Expand Down

0 comments on commit b24911f

Please sign in to comment.