Errors in Wayfinder

Most errors in Wayfinder are treated as if the page requested does not exist (404). You can always throw your own errors with more appropriate error codes if required.

$this->_error = new Errors();
$this->_error->index(410);

You can also overwrite the titles and/or the messages generated by Wayfinder. An error code is required, but the $title and $message parameters are optional and should be specified in that order. If you only want to set the message and not a title, then you can pass the title as false.

$this->_error = new Errors();
// error = 410, title = Gone
$this->_error->index(410, 'Gone');
$this->_error = new Errors();
// error = 410, message = find it here...
$this->_error->index(410, false, 'find it here...');

Supported error codes

You can pass your own error codes and error messages, but the following error codes are supported out of the box:

  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 501 Not Implemented
  • 503 Service Unavailable
  • 404 Not Found