# Error Objects

## **Error Objects**

### Basic Errors

### **Advanced Errors**

If the error parameter is a string then the string value will be displayed in the notification window for the user that requested the lookup. In the event that you want to return more error details than can be reasonably captured in a string you should return an array of JSON API error objects keyed by `errors` in the top level of the return error object. A JSON API error object consists of the following properties:

### Advanced Error Properties

#### **detail**

required | *string*

A human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be localized.

**status**

optional | *string*

The HTTP status code applicable to this problem, expressed as a string value.

**title**

optional | *string*

A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.

**code**

optional | *string*

An application-specific error code, expressed as a string value.

**meta**

optional | *object*

A meta object containing non-standard meta-information about the error.

The following is an example error object

```javascript
// Example of returning JSON API formatted errors
// Note the single error object must be returned as an array keyed 
// on `errors`.
let jsonApiErrors = {
    errors: [{
        detail: "This is an error message",
        status: '400',
        title: '',
        code: '978',
        meta:{
          stackTrace: ''
        }    
    }]
};

cb(jsonApiErrors);
```

##
