UNPKG

xpath-ts2

Version:

DOM 3 and 4 XPath 1.0 implementation for browser and Node.js environment with support for typescript 5.

32 lines 967 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.XPathException = void 0; class XPathException extends Error { static INVALID_EXPRESSION_ERR = 51; static TYPE_ERR = 52; static fromMessage(message, error) { return new XPathException(undefined, error, message); } code; exception; constructor(code, error, message) { super(getMessage(code, error) || message); this.code = code; this.exception = error; } toString() { return this.message; } } exports.XPathException = XPathException; function getMessage(code, exception) { const msg = exception ? ': ' + exception.toString() : ''; switch (code) { case XPathException.INVALID_EXPRESSION_ERR: return 'Invalid expression' + msg; case XPathException.TYPE_ERR: return 'Type error' + msg; } return undefined; } //# sourceMappingURL=xpath-exception.js.map