node-restify
node-restify copied to clipboard
Restify JSON client error is showing a type "F" instead of object
Restify Version
"restify": "7.6.0",
"restify-clients": "2.6.4"
Node.js Version
10.7.0
Expected behaviour
Restify JSON client should provide error as JSON object
Actual behaviour
It is giving error of some "F" type. See attached screenshot.
Repro case
- Create a JSON client.
- Give get request from JSON client to unavailable endpoint (to generate error) and check the JSON in debug
- You will see it as "F" type.
Below is the stack, I am getting in the above error: "NotFoundError at Object.createHttpErr (/usr/src/node_modules/restify-clients/lib/helpers/errors.js:91:26) at ClientRequest.onResponse (/usr/src/node_modules/restify-clients/lib/HttpClient.js:309:26) at Object.onceWrapper (events.js:273:13) at ClientRequest.emit (events.js:182:13) at ClientRequest.EventEmitter.emit (domain.js:441:20) at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21) at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17) at Socket.socketOnData (_http_client.js:442:20) at Socket.emit (events.js:182:13) at Socket.EventEmitter.emit (domain.js:441:20)"
Is it issue while parsing restify error object like https://github.com/restify/node-restify/issues/1410?
The constructors for the errors used by restify-clients and restify come from restify-errors. It looks like your IDE is picking up the method in which we dynamically construct the error: https://github.com/restify/errors/blob/master/lib/index.js#L57
That certainly doesn't seem great. Does F instanceof Error
return true? The return value should continue to be a real error object.