Custom error pages


I was playing around with Kirby 3 errorpages. And i was trying to create errorpages for different httpstatuscodes.

My idea was that i would redirect to the errorpage using go('error', 401); And that I would check the httpstatuscode in my controller to get the right message to display.

The problem is that i cant access the status code in my controller. I always get a 200.
Also when i use http_response_code();

The response object also holds the wrong status code. And is only set after the controller function has been called.

Also the error page is always returned as a 404:

   if (is_a($input, 'Kirby\Cms\Page')) {
            $html = $input->render();

            if ($input->isErrorPage() === true) {
                if ($response->code() === null) {

            return $response->send($html);

Iam thinking wrong? I would love some feedback on handling different status codes.