Hey,
in
https://github.com/eoko/node-api-problem/tree/4071cfdcee096f9cbfd6c8d36b51ab6f032f2000#use-api-problem-in-a-middleware the README documents how to send errors in an express middleware like this:
however, when I execute this:
> var ApiProblem = require('node-api-problem');
undefined
>
> var Issue12Problem = new ApiProblem('http://api.acme.com/kb/issues/12','Error documented by issue 12');
undefined
> Issue12Problem.send()
I get the following error message:
TypeError: Issue12Problem.send is not a function
at repl:1:16
at sigintHandlersWrap (vm.js:22:35)
at sigintHandlersWrap (vm.js:96:12)
at ContextifyScript.Script.runInThisContext (vm.js:21:12)
at REPLServer.defaultEval (repl.js:313:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.<anonymous> (repl.js:513:10)
at emitOne (events.js:101:20)
at REPLServer.emit (events.js:188:7)
Grepping the repository doesn't mention send outside of the README :(
$> git log|head -n1
commit 4071cfdcee096f9cbfd6c8d36b51ab6f032f2000
$> git grep send
README.md: err.send(res);
I've been using
res.set({
'Content-Type': 'application/problem+json'
});
res.status(err.status);
res.send(err.toJSON());
in the meantime as a workaround, but maybe that should be part of this very library.
Hey,
in
https://github.com/eoko/node-api-problem/tree/4071cfdcee096f9cbfd6c8d36b51ab6f032f2000#use-api-problem-in-a-middleware the README documents how to send errors in an express middleware like this:
however, when I execute this:
I get the following error message:
Grepping the repository doesn't mention
sendoutside of the README :(I've been using
in the meantime as a workaround, but maybe that should be part of this very library.