Vulcan/packages/vulcan-lib/lib/server/errors.js

16 lines
356 B
JavaScript
Raw Normal View History

2019-03-12 21:57:11 +09:00
import { UserInputError } from 'apollo-server';
/*
An error should have:
- id: will be used as i18n key (note: available as `name` on the client)
- message: optionally, a plain-text message
- data: data/values to give more context to the error
*/
export const throwError = error => {
const { id, } = error;
2019-03-12 21:57:11 +09:00
throw new UserInputError(id, error);
};