declapract
Version:
A tool to declaratively define best practices, maintainable evolve them, and scalably enforce them.
15 lines • 632 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserInputError = void 0;
const capitalizeFirstLetter = (string) => {
return string.charAt(0).toUpperCase() + string.slice(1);
};
class UserInputError extends Error {
constructor(reason, opts) {
super(`
User input error. ${capitalizeFirstLetter(reason.trim().replace(/\.$/, ''))}. Please correct this and try again.${(opts === null || opts === void 0 ? void 0 : opts.potentialSolution) ? `\n\n${opts.potentialSolution}` : ''}
`.trim());
}
}
exports.UserInputError = UserInputError;
//# sourceMappingURL=UserInputError.js.map
;