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

Last thesis in error-handling guidelines isn't reproducible #21

Open
KLarpen opened this issue Dec 9, 2023 · 2 comments · May be fixed by #32
Open

Last thesis in error-handling guidelines isn't reproducible #21

KLarpen opened this issue Dec 9, 2023 · 2 comments · May be fixed by #32

Comments

@KLarpen
Copy link
Contributor

KLarpen commented Dec 9, 2023

The documentation section Error-handling guidelines contains the sentences

Docs/content/en/LAYERS.md

Lines 163 to 166 in 3f3b82e

How to override error codes: `throw new Error('Method is not implemented', 404);`
This will take error message from code: `{"callback":1,"error":{"message":"Not found","code":404}}`
If you specify unknown code like this: `throw new Error('Method is not implemented', 12345);` this will generate: `"Internal Server Error"` with `"code":500`.

Trying to reproduce this behaviour with Example project brings unexpected results. The way I had tried:

  1. Setup database
  2. Start the example server
  3. Open http://127.0.0.1:8000 in the Chrome
  4. Open DevTools with network and console tabs
  5. Click on api WebSocket request and there on Messages tab. Check that auth/signin request was successful with the status logged.
  6. Write in console await api.example.customException();
  7. The result {message: "Custom ecxeption", code: 12345} despite documentation says that unknown error code will generate: "Internal Server Error" with "code":500.
  8. Change error code in the file application/api/example/customException.js to 404. Save and check that update has been reloaded by server.
  9. Call again in console await api.example.customException();
  10. The result {message: "Custom ecxeption", code: 404} instead of automatic replacement of the message with "Not found" as being told at the documentation.
  11. The same behaviour with public endpoint.

What is the desired latest behaviour: that mentioned in documentation OR that actually works in Example?

@KLarpen
Copy link
Contributor Author

KLarpen commented Dec 11, 2023

Please review @tshemsedinov . The PR proposal may be created only based on an answer to the last question.

@KLarpen
Copy link
Contributor Author

KLarpen commented Dec 14, 2023

The question was reviewed at the community call 133 14.12.2023. Decision: the right behavior in the documentation, so it must be reported as issue into code repository impress or metacom.

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

Successfully merging a pull request may close this issue.

1 participant