You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When sending error with next(error) callback, response sent to client does not contain optionnal properties of my new Error Object created with makeConstructor restify-errors module.
Env : Node v12.18.3 with ESM loader (type: "module") in package.json
Example :
importerrsfrom'restify-errors';constTestError=errs.makeConstructor("TestError",{statusCode: 500,info: {errcode: "ERR_GENERIC"},message:"App Error"});consttmp=newTestError();console.log("tmp.info exists : ",JSON.stringify(tmp.info));console.log("But this is sent to client when next(tmp) called : ",JSON.stringify(tmp));
Print :
tmp.info exists : {"errcode":"ERR_GENERIC"}
But this is sent to client when next(tmp) called : {"code":"Test","message":"App Error"}
It seems to be caused by JSON.stringify that only check for ownProperties (it don't look for prototype chain).
The text was updated successfully, but these errors were encountered:
When sending error with next(error) callback, response sent to client does not contain optionnal properties of my new Error Object created with makeConstructor restify-errors module.
Env : Node v12.18.3 with ESM loader (type: "module") in package.json
Example :
Print :
It seems to be caused by JSON.stringify that only check for ownProperties (it don't look for prototype chain).
The text was updated successfully, but these errors were encountered: