botbuilder-dialogs
Version:
A dialog stack based conversation manager for Microsoft BotBuilder.
39 lines • 1.6 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.DialogContextError = void 0;
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
const dialogContext_1 = require("./dialogContext");
/**
* An Error that includes extra dialog context, including the dialog stack.
*/
class DialogContextError extends Error {
/**
* Construct a DialogError.
*
* @param {Error | string} error Source error or error message.
* @param {DialogContext} dialogContext Dialog context that is the source of the error.
*/
constructor(error, dialogContext) {
var _a, _b, _c;
super();
this.error = error;
if (!(error instanceof Error) && typeof error !== 'string') {
throw new Error('`error` argument must be an Error or a string');
}
if (!(dialogContext instanceof dialogContext_1.DialogContext)) {
throw new Error('`dialogContext` argument must be of type DialogContext');
}
this.name = 'DialogContextError';
this.message = error instanceof Error ? error.message : error;
this.dialogContext = {
activeDialog: (_a = dialogContext.activeDialog) === null || _a === void 0 ? void 0 : _a.id,
parent: (_c = (_b = dialogContext.parent) === null || _b === void 0 ? void 0 : _b.activeDialog) === null || _c === void 0 ? void 0 : _c.id,
stack: dialogContext.stack,
};
}
}
exports.DialogContextError = DialogContextError;
//# sourceMappingURL=dialogContextError.js.map
;