UNPKG

majas

Version:

Format-agnostic structure converter.

18 lines (17 loc) 547 B
export default class ParseError extends Error { input; constructor(format, input, message, cause) { super([ `failed to parse ${format.displayName}`, message !== undefined && message, cause !== undefined && cause !== null && cause, 'input', input.length > 1000 ? input.slice(0, 1000) + '…' : input, ] .filter(v => v !== false) .join(':')); this.name = 'ParseError'; this.input = input; this.cause = cause; } }