@digitaldefiance/i18n-lib 1.0.28 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/typed-error.js +3 -0
- package/package.json +1 -1
package/dist/typed-error.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TypedError = void 0;
|
|
4
|
+
const default_config_1 = require("./default-config");
|
|
4
5
|
/**
|
|
5
6
|
* Type-safe TypedError that ensures complete enum coverage
|
|
6
7
|
*/
|
|
7
8
|
class TypedError extends Error {
|
|
8
9
|
constructor(engine, type, reasonMap, language, otherVars) {
|
|
9
10
|
const key = reasonMap[type];
|
|
11
|
+
if (!key)
|
|
12
|
+
throw new Error(engine.translate(default_config_1.DefaultStringKey.Error_MissingTranslationKeyTemplate, { type }, language));
|
|
10
13
|
super(engine.translate(key, otherVars, language));
|
|
11
14
|
this.type = type;
|
|
12
15
|
this.reasonMap = reasonMap;
|