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 for sending a custom traceback #4

Open
cycomachead opened this issue Jan 25, 2019 · 4 comments
Open

Support for sending a custom traceback #4

cycomachead opened this issue Jan 25, 2019 · 4 comments

Comments

@cycomachead
Copy link

I'm using lapis (a framework built on Openresty) and the tracebacks from the default lapis handle error are more detailed. What about a method set_custom_trace() that allows you provide your own traceback?

Alternatively it could go as part of the report call. 🤷‍♂️

@EtienneM
Copy link
Member

I never heard of Lapis but I will definitely have a look.
This library was first designed to suit our need, hence the limited capabilities in terms of customization. But I would be very happy to merge any PR that improves this part of the lib.

For this functionality, I would like the default behaviour to remain the same, and set_custom_trace would let the user customize the method called for the stacktrace.

@cycomachead
Copy link
Author

Great thanks!

For this functionality, I would like the default behaviour to remain the same, and set_custom_trace would let the user customize the method called for the stacktrace.

What I did was allow passing in a string, since I decided I wanted to tweak the look even further:
https://github.com/bromagosa/snapCloud/pull/177/files#diff-d5c255fc66c6740437720ea92cd0815fR146

I need to clean things up a bit, but here's the way I added this:
master...snap-cloud:add-traceback-users

@EtienneM
Copy link
Member

I am not really keen on the implementation of this. I would prefer that set_custom_trace takes a function as argument and this function defaults to debug.traceback.

@cycomachead
Copy link
Author

Yeah, that makes sense. I will try to work on that this weekend.

The reason I wanted to use a string is because if you're handling an error in a framework, you'll often just get a stack trace back. Internally, I can go and find that it uses debug.traceback but then I need to pass the right args to get everything at the right levels and detail.

I don't mind using function, because hey, I can just wrap a string in a function but just wanted to share my reasoning. :)

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

No branches or pull requests

2 participants