Skip to content

Conversation

@adriangb
Copy link
Contributor

@adriangb adriangb commented Feb 6, 2023

Fixes #493, partially resolves #1692 (comment), resolves #1649 (comment)

By moving handling of exceptions to the Route level we can use the same Request/WebSocket object for the endpoint and exception handlers.

See #2020 for some more background

@Kludex Kludex mentioned this pull request Feb 14, 2023
8 tasks
@Kludex Kludex requested a review from a team March 5, 2023 15:16
@Kludex
Copy link
Owner

Kludex commented Mar 5, 2023

I'm positive towards this PR. Is any other member that wants to check it? @encode/maintainers

@adriangb
Copy link
Contributor Author

@tomchristie it would be great to get your eyes on this since no one has really changed this part of the codebase since you originally wrote it

@Kludex Kludex mentioned this pull request Mar 16, 2023
11 tasks
Copy link
Owner

@Kludex Kludex left a comment

Choose a reason for hiding this comment

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

Are you strong about this code structure?

Do you mind if we maintain the exceptions.py and create a _<some_good_name_at_root_level>? I feel like importing wrap_app_handling_exceptions from middleware/exceptions is not very logic. 🤔

@encode/maintainers If someone is against this idea, or has any concerns regarding this, or want more context, anything... Please let us know. Otherwise, I'll get this merged end of next week.

@adriangb
Copy link
Contributor Author

adriangb commented Apr 14, 2023

this does not solve the problem when someone wants to access request.body in other middleware. This issue is still there, isn't it? This solution (#1519) is more straightforward as fixes the issue everywhere.

#1692 also resolves it in a way that compliments this PR, and without breaking other things.

@adriangb adriangb requested a review from a team May 4, 2023 18:59
@adriangb
Copy link
Contributor Author

adriangb commented May 4, 2023

Folks, it would be great to get some more input/review here.

@Kludex
Copy link
Owner

Kludex commented Jun 2, 2023

The last bits here:

What's our plan regarding the ExceptionMiddleware? Are we going to remove it at some point?

Also, should we update the documentation: https://www.starlette.io/exceptions/#errors-and-handled-exceptions ?

Copy link
Owner

@Kludex Kludex left a comment

Choose a reason for hiding this comment

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

Do you mind if we change the structure of the files around (I can change it)?

I'd prefer to not remove the file exceptions.py, and just create a top level _exception_handler.py.

@adriangb
Copy link
Contributor Author

adriangb commented Jun 6, 2023

Sure go for it

@Kludex
Copy link
Owner

Kludex commented Jun 7, 2023

@adriangb I didn't change the documentation, but I think we should do something there for 1.0.

Also, I applied this commit: 3fb1118 (#2026). If you didn't like it, let me know, so I can revert it. 👍

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.

Question about Request.Body()

3 participants