mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-19 20:59:37 +08:00
feat: 错误代码不存在时报错
This commit is contained in:
parent
e33654dac3
commit
9b718e4c93
@ -107,6 +107,11 @@ export class Logger {
|
|||||||
* @param params 参数
|
* @param params 参数
|
||||||
*/
|
*/
|
||||||
error(code: number, ...params: string[]) {
|
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);
|
const text = this.parseInfo(logError[code], ...params);
|
||||||
if (this.catching) {
|
if (this.catching) {
|
||||||
this.catchedInfo.push({
|
this.catchedInfo.push({
|
||||||
@ -132,6 +137,11 @@ export class Logger {
|
|||||||
* @param text 警告信息
|
* @param text 警告信息
|
||||||
*/
|
*/
|
||||||
warn(code: number, ...params: string[]) {
|
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);
|
const text = this.parseInfo(logWarn[code], ...params);
|
||||||
if (this.catching) {
|
if (this.catching) {
|
||||||
this.catchedInfo.push({
|
this.catchedInfo.push({
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
"13": "Cannot compile $1 shader. Error info: $2",
|
"13": "Cannot compile $1 shader. Error info: $2",
|
||||||
"14": "Animate extension needs 'floor-hero' extension as dependency.",
|
"14": "Animate extension needs 'floor-hero' extension as dependency.",
|
||||||
"15": "Viewport 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.",
|
"1101": "Shadow extension needs 'floor-hero' extension as dependency.",
|
||||||
"1201": "Floor-damage extension needs 'floor-binder' extension as dependency.",
|
"1201": "Floor-damage extension needs 'floor-binder' extension as dependency.",
|
||||||
"1301": "Portal extension need 'floor-binder' extension as dependency.",
|
"1301": "Portal extension need 'floor-binder' extension as dependency.",
|
||||||
"1401": "Halo extension needs 'floor-binder' extension as dependency.",
|
"1401": "Halo extension needs 'floor-binder' extension as dependency."
|
||||||
"1501": "Cannot add listener to started chase."
|
|
||||||
},
|
},
|
||||||
"warn": {
|
"warn": {
|
||||||
"1": "Resource with type of 'none' is loaded.",
|
"1": "Resource with type of 'none' is loaded.",
|
||||||
|
Loading…
Reference in New Issue
Block a user