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

Handling errors #6

Open
adantart opened this issue Aug 7, 2019 · 3 comments
Open

Handling errors #6

adantart opened this issue Aug 7, 2019 · 3 comments

Comments

@adantart
Copy link

adantart commented Aug 7, 2019

Hi there:
I'm trying to catch error to prevent php to stop if there's no parseable string, but I can't figure out how to do it ...
I've tried many options:
catch (RR\Shunt\Exception\RuntimeError | RR\Shunt\Exception\ParseError $e)
catch (ParseError $e)
catch (Exception $e)
...
but no luck ...

Any idea ? ;-)

@andig
Copy link
Owner

andig commented Aug 7, 2019 via email

@adantart
Copy link
Author

adantart commented Aug 7, 2019

RR\Shunt\Exception\RuntimeError
run-time error: undefined constant "argarwgwa"

@adantart
Copy link
Author

adantart commented Aug 7, 2019

this is an example ... I'd like to use it but I don't want execution stops if the formulae is not parseable ...

try {
 $equation = '3 + blahblah';
 $result = Parser::parse($equation);
 echo $result;
} catch (RR\Shunt\Exception\RuntimeError | RR\Shunt\Exception\ParseError $e) {
 // don't stop execution ... just do nothing
}

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

No branches or pull requests

2 participants