Skip to content

Async function error stack trace #14

@sl-sudo

Description

@sl-sudo

Hi, I'm using Elastic APM in our node projects and I found it lose stack trace when an async function throws an error. In the source code I found the error stack is first handled by stackman, and the frames will lose "From previous event" part. I found if frames length is 0, error will be handled by error-stack-parser, and the error stack can be parsed correctly.
So can the stckman also add this feature? Async functions are very commonly in node.js.
code like this:

const id = someAsyncFunction();
anotherFunction(id);

error like this:

nodejs.unhandledRejectionError: Invalid value Promise { <pending> }
    at Object.escape (/node_modules/sequelize/lib/sql-string.js:65:11)
    ......
    at processImmediate (internal/timers.js:439:21)
From previous event:
    at Function.findAll (/node_modules/sequelize/lib/model.js:1755:8)
    ......
name: "unhandledRejectionError"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions