UNPKG

@sontrx/typia

Version:

Superfast runtime validators with only one line

27 lines (25 loc) 789 B
class TypeGuardError extends Error { method; path; expected; value; fake_expected_typed_value_; constructor(props) { // MESSAGE CONSTRUCTION super(props.message || `Error on ${props.method}(): invalid type${props.path ? ` on ${props.path}` : ""}, expect to be ${props.expected}`); // INHERITANCE POLYFILL const proto = new.target.prototype; if (Object.setPrototypeOf) Object.setPrototypeOf(this, proto); else this.__proto__ = proto; // ASSIGN MEMBERS this.method = props.method; this.path = props.path; this.expected = props.expected; this.value = props.value; } } export { TypeGuardError }; //# sourceMappingURL=TypeGuardError.mjs.map