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

Bug: exception representation swallows errors #188

Closed
Bobronium opened this issue Jun 28, 2022 · 6 comments
Closed

Bug: exception representation swallows errors #188

Bobronium opened this issue Jun 28, 2022 · 6 comments
Labels
Bug 🐛 This is something that is not working as expected Good First Issue This is good for newcomers to take on

Comments

@Bobronium
Copy link
Contributor

Bobronium commented Jun 28, 2022

From #174 (comment):

Also a shame that pytest seems to be stripping out the error message pointing to the extra install requirement.

Turns out, It's not pytest, it's actually starlite :)

StarLiteException eats exception args, doesn't pass them to Exception and doesn't define custom __str__
While __repr__ is defined, that not what python uses to display errors.

My proposal: ditch custom __repr__ altogether and rely on Exception.args.
And make detail a property of args joined together (which is actually just Exception.__str__)

@Goldziher
Copy link
Contributor

Go ahead

@peterschutt
Copy link
Contributor

Turns out, It's not pytest, it's actually starlite :)

Oh, OK - nice catch.. I suppose I should have checked before throwing pytest under bus like that 😆

@peterschutt peterschutt added the Bug 🐛 This is something that is not working as expected label Jun 28, 2022
@Goldziher
Copy link
Contributor

Another thing we need to take care when doing this is to support headers being passed to exception, as is done in starlette.exceptions.HTTPException.

@Bobronium will you be taking over this issue?

@Bobronium
Copy link
Contributor Author

Bobronium commented Jun 30, 2022

@peterschutt, yep, I'm working on it. Though it may take a couple of days or even weeks, since I'm a bit more busy with life right now :)

I'm fighting with backwards/cross compatibility with starlette at the moment.

@Goldziher Goldziher changed the title Fix exceptions representation Bug: exception representation swallows errors Jul 6, 2022
@Bobronium
Copy link
Contributor Author

Ok, so I've been working on this for couple of days, but struggling to continue.

If anyone wants to pick up on this, please let me know.

I'm still committed to do this, but don't want to stop anyone who's able to do it quicker than me. If no one will pick this up, there's a great chance I will do it some time later.

@Goldziher
Copy link
Contributor

Ok, thanks for your efforts @Bobronium

@Goldziher Goldziher added the Good First Issue This is good for newcomers to take on label Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 This is something that is not working as expected Good First Issue This is good for newcomers to take on
Projects
None yet
Development

No branches or pull requests

3 participants