Skip to content

Exceptions

Shashank Jain edited this page Oct 1, 2016 · 3 revisions

Errors returned by the API are JSON responses in following form:

{
   "error": {
       "code": 422,
       "message": "Request could not be validated",
       "details": [
          
       ],
       "innererror": {
             "code": 1001
       }
   }
}

Exceptions and Error Codes

Exception Status Code Error Code InnerError Code Description
Request Parse Exceptions
InvalidLimitException 422 100 1007 Limit is less than 1
FilterNotFoundException 422 100 1001 Filter (eq, gt, lt, etc.) not found
InvalidFilterDefinition 422 100 1002 Filters are not in correct format
InvalidOrderingDefinitionException 422 100 1005 Ordering is not in correct format
MaxLimitException 422 100 1006 More records than max limit requested
NotAllowedToFilterOnThisFieldException 422 100 1004 Filtering on this field is not allowed
UnknownFieldException 422 100 1003 Specified field (column) does not exist
General Exceptions
ValidationException 422 422 - Form validation exception. details field the error data
RelatedResourceNotFoundException 422 422 1010 Resource in relation not found
UnauthorizedException 403 403 - Not authorized to perform this action
ResourceNotFoundException 404 404 - Requested resource not found
ApiException 400 1 - Any unknown exception

Debugging

If the APP_DEBUG environment variable is set to false, the response will be in JSON format given above. If it is true, usual Laravel error page will be returned.