-
Notifications
You must be signed in to change notification settings - Fork 78
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
Can you advice me how to catch all errors and print them nicely using the flourish fCore? #229
Comments
If you wrap your code with try & catch you can get all errors thrown on it. You can either be specific and catch a "fSQLException" or catch all expeptions thrown on this block with "fException". Hope it helps! I'm glad to see that flourish is still in use! EDITED: All non catch exceptions will be outputted if you choose 'html' or emailed if you choose an email address. To print exceptions nicely on your HTML code you need to catch each expected exception. |
Thanks for your feedback @uBizzy So when I use try-catch, I can get it to work.
However, I assumed, that using
Is an equivalent to try-catch – but it isn't then? Could you elaborate, why I should use this after all? Because using try-catch and outputting the catched errors/exception to HTML also works with plain PHP, no need using any of these Flourish classes:
|
Well, I suppose that's because you are outputting all errors and exceptions to HTML, so fCore will output them and only after that the "startErrorCapture()" and "stopErrorCapture()" are available for you to output. Try to change the error and exception to file or email and test it. Then tell me if it worked. |
Hi there,
I'm struggling a bit with the fCore & fException try-catch mechanism.
What I want to accomplish is, that all errors (and exceptions) get catched while parsing the php-script and collected, so I can run a
foreach ($errors as $error)
-loop in the end and nicely print any errors that may have occurred to the HTML output.Unfortunately I cannot get this to work - and I am confused by the documentation of these error catching features... Here's how I thought it should work – can someone advice what I'm doing wrong? :)
As you may see, I would like to have the errors & exceptions "collected" and then only printed nicely in the foreach-loop before closing /body.
Is something like this possible and what would I need to change in order to accomplish this with Flourish?
Thanks for any help & hints!
Oliver
The text was updated successfully, but these errors were encountered: