PHP Class RESTfulAPI_Error

Author: Thierry Francois @colymba [email protected]
显示文件 Open project: colymba/silverstripe-restfulapi Class Usage Examples

Public Properties

Property Type Description
$body mixed Error response body to be serialized
$code integer Error HTTP status code
$message string Error message

Public Methods

Method Description
__construct ( integer $code, string $message, $body = null ) Creates the error object and sets properties
get_json_error ( ) : false | string Check for the latest JSON parsing error and return the message if any

Method Details

__construct() public method

Creates the error object and sets properties
public __construct ( integer $code, string $message, $body = null )
$code integer HTTP status code
$message string Error message

get_json_error() public static method

More available for PHP >= 5.3.3 http://www.php.net/manual/en/function.json-last-error.php
public static get_json_error ( ) : false | string
return false | string Returns false if no error or a string with the error detail.

Property Details

$body public_oe property

Error response body to be serialized
public mixed $body
return mixed

$code public_oe property

Error HTTP status code
public int $code
return integer

$message public_oe property

Error message
public string $message
return string