Make 404 a exception instead of a response
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start with the exception handling documentation and the existing errorRoute behavior described in the issue. Trace how a 404 currently sends its header, then determine where the NotFound exception and default route belong. Done means 404 errors are catchable by type, can use route routines and content negotiation, and preserve current behavior.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Using exception handling we can make errors catchable by type. If we treat the error as an usual route we can also attach routines to it so it can respect content negotiation (as mentioned on #109).
- Throw
Respect\Rest\Exception\Http\NotFoundexception for404errors instead of just sending a header. - Create a default route to catch this exception, ensuring current behaviour is not affected.
Original issue content
I have a question about how to implement a error route for a Default 404 Not Found Page, but have not found the solution.
I created a class Error404 controller to display a standard html page, but it did not work:
$router->any('/**', 'Routes\Error404');
I also tried to use the method errorRoute, but without success.
$router->errorRoute($callback);
Is there a solution to this problem?
Thank's all to help me!
- Lingua principale
- PHP
- Stelle
- 605
- Fork
- 100
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Respect/Rest
-
Project Status Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
-
Optimize error handling Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 52/100
-
New Roadmap Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
-
Allow Router as Target Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
Tutte le issue di Respect/Rest
Issue simili
-
priority: p3
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Automattic/static-site-importer#1767 ·