Home Reference Source

application/exceptions/service-fetch-exception.js

/**
 * Custom exception to handle HTTP errors from the services. Tracks
 * <ul>
 *     <li>response - object</li>
 *     <li>method - string</li>
 *     <li>url - string</li>
 *     <li>body -string</li>
 * </ul>
 */
class ServiceFetchException {
    constructor(data) {

        this.response = data.response ? data.response : null;
        this.method = data.method ? data.method : 'GET';
        this.url = data.url ? data.url : null;
        data.body = data.body ? data.body : null;

        this.name = 'ServiceFetchException';
    }
}

export default ServiceFetchException;