question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Merge stack traces

See original GitHub issue

Tangentially related to this module, but is there any easy way to join the current stack trace (e.g. Error.captureStackTrace) with the the serialized error’s? Throwing a pre-existing error as-is may be confusing because its stack trace does not contain the current throw line’s stack.

Is the modern way to handle this via .cause?

const current = new Error('Got an error')
current.cause = deserializeError(remoteError);
throw current;

Unfortunately I think it’s not going to be well-supported for quite a while.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sindresorhuscommented, Oct 3, 2021

which don’t show it (e.g. browser console)

Hopefully, that will come sooner than later. People will start using “cause” and there will be demand.

1reaction
sindresorhuscommented, Sep 12, 2021

No good way other than string handling: https://github.com/sindresorhus/got/blob/d4e34c7625c1c7000fd1b9af00e743669f83c83a/source/core/errors.ts#L55-L67

Error#cause is really the way to do this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Merging stack traces in rethrown errors - javascript
The idea is the same: Wrapping errors in errors. However it is much simpler. It has less features, but also works in the...
Read more >
Merge stack traces into a single log event in Open Liberty 22.0 ...
When a stack trace is logged in Open Liberty, typically from Throwable.printStackTrace() calls from the application, you can now output the ...
Read more >
Merge exception stack trace into call stack
- i need to manualy "parse" StackTrace and determine source of given exception. Visual Studiovisual studio. MB.
Read more >
Merge Multiline Java Stack trace via syslog - Splunk Community
Merge Multiline Java Stack trace via syslog ... I'm having a heck of a time figuring out the best way to get splunk...
Read more >
filebeat merged java stack trace information is truncated #30020
filebeat collects java stack trace logs and uses time as a condition for merging lines. But I found that filebeat will not merge...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found