Skip to content

Commit 198580d

Browse files
committed
Add internal server error route
1 parent 8686865 commit 198580d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

config/routes.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,7 @@
2424

2525
$routes->connect('/dashboard', ['controller' => 'Dashboard', 'action' => 'index']);
2626

27+
$routes->connect('/500',['controller' => 'Dashboard', 'action' => 'internalServerError']);
28+
2729
$routes->fallbacks(DashedRoute::class);
2830
});

src/Controller/DashboardController.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
namespace App\Controller;
33

4+
use Exception;
45
use App\Controller\AppController;
56

67
/**
@@ -16,4 +17,14 @@ class DashboardController extends AppController
1617
public function index()
1718
{
1819
}
20+
21+
/**
22+
* Internal Server Error method
23+
*
24+
* @return \Cake\Http\Response|null
25+
*/
26+
public function internalServerError()
27+
{
28+
throw new Exception('500 error!');
29+
}
1930
}

0 commit comments

Comments
 (0)