Skip to content

[PageSpy] An unknown error occurred and no message or stack trace available #396

@huxinfeng

Description

@huxinfeng

Describe the bug

使用小程序实时调试;控制台日志不能正常显示对应错误;而是显示[PageSpy] An unknown error occurred and no message or stack trace available;
原因是因为

  public errorHandler(error: { message: string; stack: string }) {
    if (!ErrorPlugin.hasInitd) {
      return;
    }
    if (error.stack || error.message) {
      /* c8 ignore start */
      const { message, stack } = error;
      this.sendMessage(stack || message, formatErrorObj(error));
      /* c8 ignore stop */
    } else {
      // When the error does not exist, use default information
      const defaultMessage =
        '[PageSpy] An unknown error occurred and no message or stack trace available';
      this.sendMessage(defaultMessage, null);
    }
  }

在小程序里面,onerror的回调函数参数只有message;没有error.stack || error.message

Steps to reproduce

No response

System Info

小程序

Logs

No response

Validations

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions