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

Add a parser error manager #7

Open
gsouf opened this issue Apr 24, 2016 · 0 comments
Open

Add a parser error manager #7

gsouf opened this issue Apr 24, 2016 · 0 comments

Comments

@gsouf
Copy link
Member

gsouf commented Apr 24, 2016

An error manager should be available for parser. The reason is that the way errors are managed depend on the user of the library.

Sometimes people want the script execution fails, sometimes people want just the value to be null, and that will still depend on what kind of error.

The idea would be to use an error manager that can recognize error type and act according to the detected error.

Example with google client:

  • we want to throw exceptions when error happens while parsing a classical result, but not for other result type
  • but we want to return null when google failed to parse the title

Additionally everything will go in an error bag, containing the name/attributes of the error, the description of the error, a trace of the error (like exceptions), and the resolution chosen.

This is very repository specific, then it will be implemented as a component, and it will be added as a dependency on the packages that need it, and for instance we can define it globally for google GoogleClient::registerParsingErrorHandler($errorHandler) or per google client $googleClient->setErrorHandler($errorHandler); then other packages can do the same.

The way errors will be detected is still obscure, the obvious options would be:

  • redis-like keys NAMESPACE::ITEM::DETAILS e.g: GOOGLE::PARSING::CLASSICAL::TITLE
    and match it with regexp e.g : GOOGLE::PARSING::*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant