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 Request401
Unauthorized403
Forbidden501
Not Implemented503
Service Unavailable404
Not Found