Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot send error in "add" callback #63

Closed
ErikOrjehag opened this issue Sep 10, 2014 · 1 comment
Closed

Cannot send error in "add" callback #63

ErikOrjehag opened this issue Sep 10, 2014 · 1 comment

Comments

@ErikOrjehag
Copy link

Description

When you try to send an error to the callback function in "add" the server logs the error but it isn't sent to "act". The error variable in "act" is null and the response is {}.

Example

Service

.add(
    {generate: 'error'},
    function (args, done) {
      try {
        JSON.parse('!#%&');
      } catch (error) {
        done(error);
      }
    }
  )

Output:

2014-09-10T08:40:14.114Z    diyjrnxkxvzc/1410335482374/-    ERROR   act -   -   OUT oea0qj5hjv5h    generate:error  Unexpected token !  action-error    {id=oea0qj5hjv5h,gate=false,ungate=true,pattern=generate:error,plugin={name=-,tag=-},time={start=1410338414113,end=1410338414113}}  SyntaxError: Unexpected token !
    at Object.parse (native)
    at Seneca.<anonymous> (/Users/webdbdev3/Desktop/arbetslager/senecatest/geomService.js:55:14)
    at Object.$.executor.execute.fn (/Users/webdbdev3/Desktop/arbetslager/senecatest/node_modules/seneca/lib/seneca.js:1334:24)
    at Object._onImmediate (/Users/webdbdev3/Desktop/arbetslager/senecatest/node_modules/seneca/lib/executor.js:93:14)
    at processImmediate [as _immediateCallback] (timers.js:345:15)

Client

.act(
    {generate: 'error'},
    function (error, response) {
      console.log('error is');
      console.log(error);
      console.log('response is');
      console.log(response);
    }
  )

Output:

error is
null
response is
{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants