src/page.php
public function error($reason=null, $code=response::STATUS_INTERNAL_SERVER_ERROR, $user_message=null) {
	$response = bootstrap::get_library('response');
	
	$error_data = [
		'status_code'    => $code,
		'status_message' => $response::get_status_message($code),
	];
	$error_data['status_code_is_'.$code] = true;
	
	if ($user_message) {
		$error_data['user_message'] = $user_message;
	}
	if (ENVIRONMENT == 'development') {
		$error_data['development'] = true;
		
		if ($reason) {
			$error_data['reason'] = $reason;
		}
	}
	
	if (!empty($this->data['exception']['current'])) {
		if ($this->data['exception']['current'] instanceof \alsvanzelf\fem\exception) {
			if (empty($error_data['user_message'])) {
				$error_data['user_message'] = $this->data['exception']['current']->getUserMessage();
			}
			
			$error_data['user_action'] = $this->data['exception']['current']->getUserAction();
		}
		
		if (ENVIRONMENT != 'development') {
			unset($this->data['exception']);
		}
	}
	
	$response::send_status($code);
	
	if (empty(static::$default_error_template)) {
		$page_data = [
			'error' => $error_data,
		];
		if (!empty($this->data['exception'])) {
			$page_data['exception'] = $this->data['exception'];
		}
		
		static::show_default_error($page_data);
	}
	else {
		$this->data['title'] = $error_data['status_message'];
		$this->data['error'] = $error_data;
		
		$this->show(static::$default_error_template);
	}
	
	die;
}
public function error($reason=null, $code=response::STATUS_INTERNAL_SERVER_ERROR, $user_message=null) {
	$response = bootstrap::get_library('response');
	
	$error_data = [
		'status_code'    => $code,
		'status_message' => $response::get_status_message($code),
	];
	$error_data['status_code_is_'.$code] = true;
	
	if ($user_message) {
		$error_data['user_message'] = $user_message;
	}
	if (ENVIRONMENT == 'development') {
		$error_data['development'] = true;
		
		if ($reason) {
			$error_data['reason'] = $reason;
		}
	}
	
	if (!empty($this->data['exception']['current'])) {
		if ($this->data['exception']['current'] instanceof \alsvanzelf\fem\exception) {
			if (empty($error_data['user_message'])) {
				$error_data['user_message'] = $this->data['exception']['current']->getUserMessage();
			}
			
			$error_data['user_action'] = $this->data['exception']['current']->getUserAction();
		}
		
		if (ENVIRONMENT != 'development') {
			unset($this->data['exception']);
		}
	}
	
	$response::send_status($code);
	
	if (empty(static::$default_error_template)) {
		$page_data = [
			'error' => $error_data,
		];
		if (!empty($this->data['exception'])) {
			$page_data['exception'] = $this->data['exception'];
		}
		
		static::show_default_error($page_data);
	}
	else {
		$this->data['title'] = $error_data['status_message'];
		$this->data['error'] = $error_data;
		
		$this->show(static::$default_error_template);
	}
	
	die;
}
public function error ( $ reason = null , $ code = response :: STATUS_INTERNAL_SERVER_ERROR , $ user_message = null ) { $ response = bootstrap :: get_library ( 'response' ) ; $ error_data = [ 'status_code' => $ code , 'status_message' => $ response :: get_status_message ( $ code ) , ] ; $ error_data [ 'status_code_is_' . $ code ] = true ; if ( $ user_message ) { $ error_data [ 'user_message' ] = $ user_message ; } if ( ENVIRONMENT == 'development' ) { $ error_data [ 'development' ] = true ; if ( $ reason ) { $ error_data [ 'reason' ] = $ reason ; } } if ( ! empty ( $ this -> data [ 'exception' ] [ 'current' ] ) ) { if ( $ this -> data [ 'exception' ] [ 'current' ] instanceof \ alsvanzelf \ fem \ exception ) { if ( empty ( $ error_data [ 'user_message' ] ) ) { $ error_data [ 'user_message' ] = $ this -> data [ 'exception' ] [ 'current' ] -> getUserMessage ( ) ; } $ error_data [ 'user_action' ] = $ this -> data [ 'exception' ] [ 'current' ] -> getUserAction ( ) ; } if ( ENVIRONMENT != 'development' ) { unset ( $ this -> data [ 'exception' ] ) ; } } $ response :: send_status ( $ code ) ; if ( empty ( static :: $ default_error_template ) ) { $ page_data = [ 'error' => $ error_data , ] ; if ( ! empty ( $ this -> data [ 'exception' ] ) ) { $ page_data [ 'exception' ] = $ this -> data [ 'exception' ] ; } static :: show_default_error ( $ page_data ) ; } else { $ this -> data [ 'title' ] = $ error_data [ 'status_message' ] ; $ this -> data [ 'error' ] = $ error_data ; $ this -> show ( static :: $ default_error_template ) ; } die ; }
show an error page

@param  string $reason       technical description, only shown on development environments
@param  int    $code         http status code, @see response::STATUS_*
@param  string $user_message optional, human-friendly message to show to the user
@return void                 script execution terminates
show an error page