1 | "use strict";
|
2 | const makeError = (defaultMessage, errorName) => class CustomError extends Error {
|
3 | constructor(message) {
|
4 | super();
|
5 | this.name = errorName;
|
6 | this.message = message || defaultMessage;
|
7 | return this;
|
8 | }
|
9 | };
|
10 | module.exports = {
|
11 | "MissingSchemaError": makeError("Missing Schema", "MissingSchemaError"),
|
12 | "InvalidParameter": makeError("Invalid Parameter", "InvalidParameter"),
|
13 | "InvalidParameterType": makeError("Invalid Parameter Type", "InvalidParameterType"),
|
14 | "UnknownAttribute": makeError("The attribute can not be found", "UnknownAttribute"),
|
15 | "InvalidType": makeError("Invalid Type", "InvalidType"),
|
16 | "WaitForActiveTimeout": makeError("Waiting for table to be active has timed out", "WaitForActiveTimeout"),
|
17 | "TypeMismatch": makeError("There was a type mismatch between the schema and document", "TypeMismatch"),
|
18 | "InvalidFilterComparison": makeError("That filter comparison is invalid", "InvalidFilterComparison"),
|
19 | "ValidationError": makeError("There was an validation error with the document", "ValidationError")
|
20 | };
|
21 |
|
\ | No newline at end of file |