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

Support annotated-exception #82

Merged
merged 1 commit into from
Dec 11, 2023
Merged

Support annotated-exception #82

merged 1 commit into from
Dec 11, 2023

Conversation

chris-martin
Copy link
Collaborator

@chris-martin chris-martin commented Dec 8, 2023

Obviates https://github.com/freckle/megarepo/pull/31730 and some recent changes to freckle-app. When I roll back what I did to freckle-app I'll probably want to put an explicit lower bound on this version of bugsnag.

Also added some build infrastructure - a newer stack.yaml, and some nix stuff that helps me.

@chris-martin chris-martin force-pushed the annotated branch 2 times, most recently from b2773fc to 256adfd Compare December 8, 2023 18:20
@chris-martin chris-martin changed the title support annotations, update stack, add nix support annotations, update stack configs Dec 8, 2023
stack.yaml Outdated Show resolved Hide resolved
@chris-martin chris-martin requested a review from pbrisbin December 8, 2023 18:34
Copy link
Owner

@pbrisbin pbrisbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like annotatedExceptionBeforeNotify that sets class/message/stacktrace is yet to come?

@chris-martin
Copy link
Collaborator Author

Maybe I should go ahead and throw it into this PR.

@chris-martin
Copy link
Collaborator Author

chris-martin commented Dec 8, 2023

@pbrisbin I'm thinking we should go ahead and remove Network.Bugsnag.Exception.Parse altogether, wdyt? Would love to simplify by not trying to parse formatted traces at all. We can still display StringException traces by grabbing the call stack directly without parsing.

@pbrisbin
Copy link
Owner

pbrisbin commented Dec 8, 2023

I'm thinking we should go ahead and remove Network.Bugsnag.Exception.Parse altogether, wdyt? Would love to simplify by not trying to parse formatted traces at all

That's a good question, but I think it gets at your point about annotated-exceptions not being standardized as a callstack solution. Given that it's not, I don't think we can take away that existing support for trying to get whatever callstacks we can for users not using annotated-exception.

But I think we can evangelize, and ensure good support for annotated-exception and hope it sees broader adoption. Then, perhaps, we can make it essentially required for this library to offer good stacktraces, and we could drop that support for other methods.

@chris-martin
Copy link
Collaborator Author

Okay, I did rip that out already, but I can add it back as another fallback.

@chris-martin
Copy link
Collaborator Author

chris-martin commented Dec 8, 2023

I think this could be ready to go.

However - While we're here, might as well also upstream MetaData from freckle-app?

eh, don't want to deal with adding an aeson dependency right now. Later.

@pbrisbin
Copy link
Owner

pbrisbin commented Dec 9, 2023

might as well also upstream MetaData from freckle-app?

Yeah, any part of it that's not Freckle-specific sounds like a decent fit.

I wonder, if we did the following all internally and automatically,

  • Handle ex or AnnotatedException ex in updateFromOriginalException
  • Had a default (global, "alwasy") BeforeNotify that handled AnnotatedException and updated errorClass, message, stacktrace and attached any other Annotations as metadata

Then do we ever need to mention AnnotatedException in our API? I.e. would updateFromOriginalAnnotatedException even ever be useful?

@chris-martin
Copy link
Collaborator Author

attached any other Annotations as metadata

For annotations other than CallStack and MetaData, just apply show, and throw the list into an "annotations" bugsnag tab?

@chris-martin
Copy link
Collaborator Author

chris-martin commented Dec 11, 2023

The only reason to include annotated exceptions into the API is if the user has their own Annotation subtypes that they want to be able to report to bugsnag in some a special way. Since that's an "open" type that can hold anything, this seems conceivable.

@chris-martin
Copy link
Collaborator Author

Would be cool if freckle/blammo#30 were done :)

@chris-martin
Copy link
Collaborator Author

Going to also fourmolu this whole project because I don't know how to run brittany and it's falling over on the CPP

@pbrisbin
Copy link
Owner

pbrisbin commented Dec 11, 2023

For annotations other than CallStack and MetaData, just apply show, and throw the list into an "annotations" bugsnag tab?

I guess I defer to you. Would that be useful?

the user has their own Annotation subtypes that they want to be able to report to bugsnag in some a special way. Since that's an "open" type that can hold anything, this seems conceivable

Makes sense.

Would be cool if freckle/blammo#30 were done :)

Sure would.

@chris-martin chris-martin changed the title support annotations, update stack configs Support annotated-exception Dec 11, 2023
@chris-martin chris-martin force-pushed the annotated branch 2 times, most recently from e04adaf to f9616b8 Compare December 11, 2023 19:26
@chris-martin
Copy link
Collaborator Author

I could imagine if annotated-exception caught on more in the ecosystem at large, you could get libraries relying heavily on annotations rather than the underlying exception to convey information you might want to see in bugsnag. But this is hypothetical. And perhaps that could be remedied outside of this library by catching and re-throwing with those annotations converted to MetaData. For now I think just supporting CallStack and MetaData annotations makes sense until there is a use case to drive the design.

@chris-martin chris-martin enabled auto-merge (squash) December 11, 2023 19:41
@chris-martin chris-martin merged commit 02283d8 into main Dec 11, 2023
8 checks passed
@chris-martin chris-martin deleted the annotated branch December 11, 2023 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants