Skip to content

Rework error handling #28

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

Closed

Conversation

mrkline
Copy link

@mrkline mrkline commented Aug 29, 2016

This is a much more fleshed-out version of #25. exec_* functions now return a Result, where the Err case returns an ExecError, indicating the problem. Some errors should be impossible given the preconditions rust-pcre asserts before calling the relevant libpcre functions, so we panic in those cases.

Currently, PCRE_ERROR_PARTIAL is bundled with other errors, making
ExecPartialSoft and ExecPartialHard useless. The exec* family of
methods now returns a Result, with two possible error cases:
- A partial match occurred.
- Some other error occurred.

This is my first foray into Rust (outside tutorials and toy projects),
so forgive me if anything isn't idiomatic.
I'm happy to fix up the PR as-needed.
These were taken from pcre.h.
Up next is to map them to ExecError (likely through `detail`).
We now panic only on rust-pcre internal errors,
and provide an ExecError otherwise.
@mrkline mrkline force-pushed the rework-error-handling branch from 530981d to 33e9910 Compare August 29, 2016 02:12
@mrkline mrkline closed this Sep 6, 2022
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