- ⌂ controller
- Methods
controller::show_error()
Produce an error response and exit, which is useful when a controller can find the requested resource, but some other error occurred.
This method will send the error response and terminate PHP execution, so it never returns.
Prototype
void show_error(string $message = '', string $filename = NULL, string $status_code = 500)
Parameters
- message - Message to display on 500 (or other Status Code) page. Can contain HTML.
- filename - Path to a cMVC view that will receive the message as $message.
- status_code - The HTTP response status codes to return with the error page.
Example
// the show controller method
public function web__show($oid=0) {
$repo = $this->repo();
$object = $repo->get_by_oid($oid);
if(!$object || $object->ContentType->Identifier!='Contact'){
$repo = $this->show_error('OID does not reference a Contact');
}
echo('Found object: ' . $object->Summary());
}