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

Error handling #2

Open
passchn opened this issue Jan 13, 2023 · 0 comments
Open

Error handling #2

passchn opened this issue Jan 13, 2023 · 0 comments

Comments

@passchn
Copy link

passchn commented Jan 13, 2023

Könnte man hier statt einer NotFoundException eine UnauthorizedException verwenden?
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_client_errors
https://book.cakephp.org/4/en/development/errors.html#http-exceptions

Vorteile:

  • Es ist beim Debuggen und Testen offensichtlicher, dass die Plugin-Route funktioniert und korrekt ist, aber der Token falsch ist.
  • Es wird ein HTTP 401-Status zurückgegeben, der den Zustand besser beschreibt als 404, denn die Route ist ja korrekt.

throw new \Cake\Http\Exception\NotFoundException();

@passchn passchn changed the title Error handline Error handling Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant