Improve error reporting in RPC by printing stack trace.

This commit is contained in:
Cheng Zhao 2013-05-14 20:00:44 +08:00
parent d8a6c68bf9
commit 1bace4abb6
2 changed files with 16 additions and 10 deletions

View file

@ -18,9 +18,11 @@ wrapArgs = (args) ->
# Convert meta data from browser into real value.
metaToValue = (meta) ->
switch meta.type
when 'error' then throw new Error(meta.value)
when 'value' then meta.value
when 'array' then (metaToValue(el) for el in meta.members)
when 'error'
console.log meta.stack
throw new Error(meta.message)
else
if meta.type is 'function'
# A shadow class to represent the remote function object.