move errors to utils lib
This commit is contained in:
12
packages/netlify-cms-lib-util/src/APIError.js
Normal file
12
packages/netlify-cms-lib-util/src/APIError.js
Normal 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;
|
||||
}
|
||||
}
|
10
packages/netlify-cms-lib-util/src/EditorialWorkflowError.js
Normal file
10
packages/netlify-cms-lib-util/src/EditorialWorkflowError.js
Normal 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;
|
||||
}
|
||||
}
|
@ -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,
|
||||
};
|
||||
|
Reference in New Issue
Block a user