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

Error handling overhaul #63

Merged
merged 9 commits into from
Oct 28, 2024
Merged

Error handling overhaul #63

merged 9 commits into from
Oct 28, 2024

Conversation

defnull
Copy link
Owner

@defnull defnull commented Oct 23, 2024

Error handling needs some work. This PR changes quite a bit:

  • Split up MultipartError into semantically meaningful sub-exceptions.
  • Introduce a parse_form_data(..., ignore_errors) parameter that can be used to throw exceptions even in non-strict mode, or to suppress exceptions in strict mode. The default behavior stays the same: Throw in strict mode and ignore in non-struct mode.
  • Introduce is_form_request(environ) so you can check if a request is a form request before calling parse_form_data and trigger an exception.
  • Do not restrict form requests to POST or PUT. The only aspect that reliably identifies form submissions is the content type header.

All API changes are backwards compatible. Some behavior changes are not, but they only change undocumented or wrong behavior.

@defnull defnull marked this pull request as draft October 23, 2024 15:41
@defnull defnull force-pushed the feature-errorhandling branch from e4a0b4b to 21c5cbc Compare October 23, 2024 16:00
@defnull defnull force-pushed the feature-errorhandling branch from 21c5cbc to 37b486a Compare October 23, 2024 16:35
@defnull defnull requested a review from cjwatson October 23, 2024 17:00
@defnull defnull removed the request for review from cjwatson October 28, 2024 16:08
@defnull defnull marked this pull request as ready for review October 28, 2024 16:08
@defnull defnull force-pushed the feature-errorhandling branch from ebc9137 to f6eaec6 Compare October 28, 2024 16:11
@defnull defnull force-pushed the feature-errorhandling branch from f6eaec6 to 28edd69 Compare October 28, 2024 16:18
@defnull defnull merged commit 7958df2 into master Oct 28, 2024
10 checks passed
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.

1 participant