UNPKG

@microsoft/omnichannel-chat-sdk

Version:
52 lines 2.39 kB
"use strict"; /** * Utilities to suppress exception on failures in ChatSDK. * * It should catch an exception, then silently fail. Not every exception thrown should be known by the user. * * An exception details object would be logged in telemetry with ChatSDK standard errors as response with the exception object if any. * * If a longer message needs to displayed to the user, a console.error() would be preferred. * * Stack trace should only be logged and not printed. */ var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.suppressConversationDetailsRetrievalFailure = exports.suppressChatSDKError = void 0; var ChatSDKError_1 = require("../core/ChatSDKError"); var suppressChatSDKError = function (chatSDKError, e, scenarioMarker, telemetryEvent, telemetryData, message) { if (telemetryData === void 0) { telemetryData = {}; } if (message === void 0) { message = ""; } var exceptionDetails = { response: chatSDKError }; if (e) { exceptionDetails.errorObject = "".concat(e); } scenarioMarker.failScenario(telemetryEvent, __assign(__assign({}, telemetryData), { ExceptionDetails: JSON.stringify(exceptionDetails) })); if (message) { exceptionDetails.message = message; console.error(message); } }; exports.suppressChatSDKError = suppressChatSDKError; var suppressConversationDetailsRetrievalFailure = function (e, scenarioMarker, telemetryEvent, telemetryData) { if (telemetryData === void 0) { telemetryData = {}; } (0, exports.suppressChatSDKError)(ChatSDKError_1.ChatSDKErrorName.ConversationDetailsRetrievalFailure, e, scenarioMarker, telemetryEvent, telemetryData); }; exports.suppressConversationDetailsRetrievalFailure = suppressConversationDetailsRetrievalFailure; exports.default = { suppressChatSDKError: exports.suppressChatSDKError, suppressConversationDetailsRetrievalFailure: exports.suppressConversationDetailsRetrievalFailure }; //# sourceMappingURL=exceptionSuppressors.js.map