dynamoose-utils
Version:
Dynamoose is a modeling tool for Amazon's DynamoDB (inspired by Mongoose)
22 lines (21 loc) • 1.16 kB
JavaScript
const makeError = (defaultMessage, errorName) => class CustomError extends Error {
constructor(message) {
super();
this.name = errorName;
this.message = message || defaultMessage;
return this;
}
};
module.exports = {
"MissingSchemaError": makeError("Missing Schema", "MissingSchemaError"),
"InvalidParameter": makeError("Invalid Parameter", "InvalidParameter"),
"InvalidParameterType": makeError("Invalid Parameter Type", "InvalidParameterType"),
"UnknownAttribute": makeError("The attribute can not be found", "UnknownAttribute"),
"InvalidType": makeError("Invalid Type", "InvalidType"),
"WaitForActiveTimeout": makeError("Waiting for table to be active has timed out", "WaitForActiveTimeout"),
"TypeMismatch": makeError("There was a type mismatch between the schema and document", "TypeMismatch"),
"InvalidFilterComparison": makeError("That filter comparison is invalid", "InvalidFilterComparison"),
"ValidationError": makeError("There was an validation error with the document", "ValidationError"),
"OtherError": makeError("There was an error", "OtherError")
};
;