UNPKG

@sap/xssec

Version:

XS Advanced Container Security API for node.js

37 lines (32 loc) 913 B
/** * Base class for XssecErrors. */ class XssecError extends Error { /** * @type {number} Suggested HTTP response code for consumer application catching this error */ #statusCode; constructor(message) { super(message); this.name = "XssecError"; this.statusCode = 500; } get statusCode() { return this.#statusCode; } /** * @type {number} Lowercased version of {@link #statusCode} for backward-compatibility */ get statuscode() { return this.#statusCode; } /** * Allows overriding suggested response status code in subclasses, e.g. 403 in ValidationError * @internal * @param {number} statusCode - Suggested HTTP response code for consumer application catching this error */ set statusCode(statusCode) { this.#statusCode = statusCode; } } module.exports = XssecError;