"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseException = void 0;
const ui_1 = require("../lib/ui");
class BaseException extends Error {
    constructor(substitutions) {
        super();
        this.substitutions = {};
        if (substitutions) {
            this.substitutions = substitutions;
        }
    }
    getMessage() {
        var _a;
        let message = ui_1.MESSAGES[(_a = this.MESSAGE_TITLE) !== null && _a !== void 0 ? _a : 'DEFAULT'];
        const substitutions = this.getSubstitutions();
        Object.entries(substitutions).forEach(([key, value]) => (message = message.replace(`[${key}]`, value)));
        return message;
    }
    getSubstitutions() {
        return this.substitutions;
    }
}
exports.BaseException = BaseException;
