File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -196,7 +196,9 @@ public function handle(?string $uri = null)
196196 // Controllers/directories, but the application may not
197197 // want this, like in the case of API's.
198198 if (! $ this ->collection ->shouldAutoRoute ()) {
199- throw new PageNotFoundException ("Can't find a route for ' {$ uri }'. " );
199+ throw new PageNotFoundException (
200+ "Can't find a route for ' {$ this ->collection ->getHTTPVerb ()}: {$ uri }'. "
201+ );
200202 }
201203
202204 // Checks auto routes
Original file line number Diff line number Diff line change @@ -384,6 +384,16 @@ public function testAutoRouteRejectsInitController()
384384 $ router ->autoRoute ('home/initController ' );
385385 }
386386
387+ public function testExceptionMessageWhenRouteNotFound ()
388+ {
389+ $ router = new Router ($ this ->collection , $ this ->request );
390+
391+ $ this ->expectException (PageNotFoundException::class);
392+ $ this ->expectExceptionMessage ("Can't find a route for 'get: url/not-exists' " );
393+
394+ $ router ->handle ('url/not-exists ' );
395+ }
396+
387397 public function testDetectsLocales ()
388398 {
389399 $ router = new Router ($ this ->collection , $ this ->request );
You can’t perform that action at this time.
0 commit comments