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

Rework encode()'s error handling #22

Merged
merged 1 commit into from
Dec 30, 2021
Merged

Rework encode()'s error handling #22

merged 1 commit into from
Dec 30, 2021

Conversation

jparise
Copy link
Owner

@jparise jparise commented Dec 30, 2021

We no longer use a regular expression to validate the input string.
Instead, the logic within the per-character encoding loop has been
improved to catch all of the known error cases and raise appropriate
ValueError exceptions.

One notable behavioral change: we now raise an error for unsupported
character codes within the 0..69 range.

This results in slightly faster code with more useful errors. For
example, we now include the actual character that we've identified as
invalid, which aids in debugging.

@jparise jparise force-pushed the encode-errors branch 2 times, most recently from 332e432 to 9f5cae9 Compare December 30, 2021 03:52
We no longer use a regular expression to validate the input string.
Instead, the logic within the per-character encoding loop has been
improved to catch all of the known error cases and raise appropriate
ValueError exceptions.

This results in slightly faster code with more useful errors. For
example, we now include the actual character that we've identified as
invalid, which aids in debugging.
@jparise jparise merged commit dee4eac into main Dec 30, 2021
@jparise jparise deleted the encode-errors branch December 30, 2021 18:45
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