-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Conversion of a thrown exceptions with unknown error codes or 404 not happening #485
Comments
I had investigated that thrown error code conversion for normal API endpoints happens in Lines 266 to 273 in 79b00cb
Webhooks always return 500 Internal Server Error for all thrown exceptions as they processed in specific method Lines 344 to 350 in 79b00cb
Possible conversion of the error message to be responded to client happens in Lines 100 to 103 in 79b00cb
Note that method used to send both: domain errors and thrown exceptions. |
Notice: custom exceptions with error code less then 500 still be passed as is (neither code not message won't be converted). The basis of the decision — potential necessity to imitate client error responses (400-499). Closes: metarhia#485
Fix conversion of a thrown exceptions with unknown error codes Notice: custom exceptions with error code less then 500 still be passed as is (neither code not message won't be converted). The basis of the decision — potential necessity to imitate client error responses (400-499). Closes: #485 PR-URL: #486
Describe the bug
Expected conversion of a thrown exceptions from API endpoints doesn't happening. Message with unknown error code still returns to the client as is without been converted into 500 Internal Server Error. Message with 404 error code also returns to the client as is without been replaced by "Not Found".
To Reproduce
api
WebSocket request and there on Messages tab. Check thatauth/signin
request was successful with the statuslogged
.await api.example.customException();
and run{message: "Custom ecxeption", code: 12345}
despite expectation that unknown error code will generate: "Internal Server Error" with "code":500. Server log:throw new Error('Custom exception', 12345);
intorounter
method atapplication/api/hook.1.js
application/api/example/customException.js
to404
. Save and check that update has been reloaded by server.application/api/hook.1.js
.await api.example.customException();
{message: "Custom ecxeption", code: 404}
despite expectation of automatic replacement of the message with "Not found". Server log:Expected behavior
The documentation section Error-handling guidelines contains the sentences
Desktop:
##Additional context
Necessity to report a bug originates from metarhia/Docs#21 that had been discussed at the community call 133. Decision to make issue in Metacom repository based on discovery that thrown exceptions is processed by
Server.rpc
ORServer.hook
and in both situations going toTransport.error
.The text was updated successfully, but these errors were encountered: