UNPKG

sinch-rtc

Version:

RTC JavaScript/Web SDK

37 lines 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MXPError = void 0; /** * Custom error class for MXP protocol */ class MXPError extends Error { constructor(code, exception) { super(); /** * Map messages to eror codes */ this.Messages = { 1: "Key used to decryption is invalid", 2: "Decryption process has failed", 3: "MXPMessage has invalid structure", 4: "MXP Body has declared different body type than expected", 5: "Error while parsing data in MXP Body object", }; this.name = "MXPError"; this.code = code; this.message = `${this.Messages[code]} :: ${exception}`; this.originalMessage = exception; } } exports.MXPError = MXPError; /** * Map containing contstant error codes for MXP protocol */ MXPError.Codes = { INVALID_DECRYPTION_KEY: 1, DECRYPTION_FAIL: 2, INVALID_MESSAGE: 3, INVALID_BODY_TYPE: 4, BODY_PARSE_FAIL: 5, }; //# sourceMappingURL=MXPError.js.map