move errors to utils lib

This commit is contained in:
Shawn Erquhart
2018-07-16 23:08:16 -04:00
parent 4931711892
commit e491f2a085
10 changed files with 17 additions and 15 deletions

View File

@ -0,0 +1,12 @@
export const API_ERROR = 'API_ERROR';
export default class APIError extends Error {
constructor(message, status, api, meta={}) {
super(message);
this.message = message;
this.status = status;
this.api = api;
this.name = API_ERROR;
this.meta = meta;
}
}

View File

@ -0,0 +1,10 @@
export const EDITORIAL_WORKFLOW_ERROR = 'EDITORIAL_WORKFLOW_ERROR';
export default class EditorialWorkflowError extends Error {
constructor(message, notUnderEditorialWorkflow) {
super(message);
this.message = message;
this.notUnderEditorialWorkflow = notUnderEditorialWorkflow;
this.name = EDITORIAL_WORKFLOW_ERROR;
}
}

View File

@ -2,6 +2,8 @@ import localForage from './localForage';
import { resolvePath, basename, fileExtensionWithSeparator, fileExtension } from './path';
import { filterPromises, resolvePromiseProperties, then } from './promise';
import unsentRequest from './unsentRequest';
import APIError from './APIError';
import EditorialWorkflowError from './EditorialWorkflowError';
export {
localForage,
@ -13,4 +15,6 @@ export {
resolvePromiseProperties,
then,
unsentRequest,
APIError,
EditorialWorkflowError,
};