added default error messages to errorResponse and badRequest
This commit is contained in:
@ -15,11 +15,20 @@ abstract class Endpoint {
|
||||
function errorResponse(
|
||||
$errors = array(), $meta = array(), $status = Response::STATUS_NOT_FOUND
|
||||
) {
|
||||
|
||||
if(empty($errors)) {
|
||||
$errors = array(
|
||||
'unknown' => __('An unknown error occurred.')
|
||||
);
|
||||
}
|
||||
return new ErrorResponse($errors, $meta, $status);
|
||||
}
|
||||
|
||||
function badRequest($errors = array(), $meta = array()) {
|
||||
if(empty($errors)) {
|
||||
$errors = array(
|
||||
'bad_request' => __('Invalid request parameters.')
|
||||
);
|
||||
}
|
||||
return new ErrorResponse($errors, $meta, Response::STATUS_BAD_REQUEST);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user