diff --git a/src/core/common/logger.ts b/src/core/common/logger.ts index 433d762..1e4abe9 100644 --- a/src/core/common/logger.ts +++ b/src/core/common/logger.ts @@ -107,6 +107,11 @@ export class Logger { * @param params 参数 */ error(code: number, ...params: string[]) { + const info = logError[code]; + if (!info) { + logger.error(16, 'error', code.toString()); + return; + } const text = this.parseInfo(logError[code], ...params); if (this.catching) { this.catchedInfo.push({ @@ -132,6 +137,11 @@ export class Logger { * @param text 警告信息 */ warn(code: number, ...params: string[]) { + const info = logWarn[code]; + if (!info) { + logger.error(16, 'warn', code.toString()); + return; + } const text = this.parseInfo(logWarn[code], ...params); if (this.catching) { this.catchedInfo.push({ diff --git a/src/data/logger.json b/src/data/logger.json index 5e5b70f..f8b9b91 100644 --- a/src/data/logger.json +++ b/src/data/logger.json @@ -15,11 +15,11 @@ "13": "Cannot compile $1 shader. Error info: $2", "14": "Animate extension needs 'floor-hero' extension as dependency.", "15": "Viewport extension needs 'floor-hero' extension as dependency.", + "16": "Cannot find log message for $1 code $2.", "1101": "Shadow extension needs 'floor-hero' extension as dependency.", "1201": "Floor-damage extension needs 'floor-binder' extension as dependency.", "1301": "Portal extension need 'floor-binder' extension as dependency.", - "1401": "Halo extension needs 'floor-binder' extension as dependency.", - "1501": "Cannot add listener to started chase." + "1401": "Halo extension needs 'floor-binder' extension as dependency." }, "warn": { "1": "Resource with type of 'none' is loaded.",