UNPKG

jhipster-domain-language

Version:
30 lines (25 loc) 576 B
'use strict'; /** * This constant is where all the error cases go. * No need to assign anything to the keys, the following loop will take care of * that. */ const EXCEPTIONS = { IllegalArgument: null, WrongFile: null, }; for (let key in EXCEPTIONS) { EXCEPTIONS[key] = key; } module.exports = { exceptions: EXCEPTIONS, buildException: buildException }; function buildException(name, message) { var exception = { name: name ? `${name}Exception` : 'Exception', message: (message || '') }; exception.prototype = new Error(); return exception; }