Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to specify custom stack trace #1719

Open
bogdan opened this issue Jan 12, 2025 · 2 comments
Open

Ability to specify custom stack trace #1719

bogdan opened this issue Jan 12, 2025 · 2 comments
Labels
awaiting feedback Awaiting a response from a customer. Will be automatically closed after approximately 2 weeks.

Comments

@bogdan
Copy link

bogdan commented Jan 12, 2025

I have an application with custom ApplicationError class that captures Thread.callStackSymbols in init.
I want this stack to be used when notifying Bugsnag about the error to override default call stack:

class ApplicationError: LocalizedError {
  message: String
  stack: [String]
  
  init(_ message: String) {
    self.message = message
    self.stack = Thread.callStackSymbols
  }
}

func notify(error: ApplicationError) {
    Bugsnag.notify(error) { event in
        event.stack = error.stack
   }
}

Please add the feature.

@hannah-smartbear
Copy link

Hi @bogdan,

You can attach your own stacktrace to BugSnag events by modifying the Error object:
event.errors[0].stacktrace = <attach stacktrace here>

It may be worth noting that you can also update the stacktrace for the errorReportingThread in the Threads tab too: https://docs.bugsnag.com/platforms/ios/customizing-error-reports/#threads

I hope this helps, but please let us know if you have any questions about this, or if I have misunderstood what you are looking for.

@hannah-smartbear hannah-smartbear added the awaiting feedback Awaiting a response from a customer. Will be automatically closed after approximately 2 weeks. label Jan 17, 2025
@bogdan
Copy link
Author

bogdan commented Jan 17, 2025

The problem is that the type of that value is [BugsnagStackframe]. How do I construct an instance of that object from Threads.callStackSymbols?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback Awaiting a response from a customer. Will be automatically closed after approximately 2 weeks.
Projects
None yet
Development

No branches or pull requests

2 participants