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 improvements #94

Merged
merged 3 commits into from
Dec 14, 2023
Merged

Error handling improvements #94

merged 3 commits into from
Dec 14, 2023

Conversation

jugglerchris
Copy link
Owner

The main change is that the underlying functions use Result for error handling rather than panicking for everything. The top level wrappers still panic.
Some unwrap() that would panic on API usage errors have been changed to expect() with a message which might help.

One difference in output: some possible inputs which previously came out wider than requested will now return Err(Error::TooNarrow).

Address #93.

Introduce Result<> in some places rather than panics.
In particular, some cases which end up with a zero width now return an
error rather than panicking.

The top-level from_read etc. still unwrap the error.
Add another test case, which has a 2 cell wide character which tries
to fit into a width of 1; this previously had an infinite loop but
will now return an error.
@jugglerchris jugglerchris merged commit 42fe0e5 into main Dec 14, 2023
4 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