RestServer
RestServer copied to clipboard
Extend RestException to also accept error object
This enables the developer to return additional data to user. So in case of an error in REST function, the error can be additionaly explained
in code:
throw new RestException(400, "Missing properties", ["severity" => "high", "missing" => ['date', 'name']]);
in REST response
{
"error": {
"code": 400,
"message": "Missing properties",
"data": {
"severity": "high",
"missing": [
"date",
"name"
]
}
}
}