Comments (3)
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.
from flourish-classes.
Thanks for your feedback @uBizzy
So when I use try-catch, I can get it to work.
<?php
try{
$db = new fDatabase('mysql', 'testdb', 'root', 'root'); // 'testdb' does NOT exists => connection error
$db->connect();
}
catch(Exception $e) {
array_push($errors, $e->getMessage());
}
?>
However, I assumed, that using
fCore::startErrorCapture();
some code
$errors = fCore::stopErrorCapture();
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:
fCore::enableErrorHandling('html');
fCore::enableExceptionHandling('html');
fCore::startErrorCapture();
from 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.
from flourish-classes.
Related Issues (20)
- fCache unserialize error
- fEmail exec shell_exec check doesn't make sense
- fActiveRecord silently overrides some column defaults on insert HOT 1
- loadHTMLBody Issues
- fResult doesn't unescape integer and float types.
- parseResponse in fMailbox.php dies when the mail subject includes {123456} HOT 3
- Any way to add non database "fields" to fActiveRecord?
- Creating functions and procedures
- Send email as Content-Transfer-Encoding: 8bit
- fEmail: Validate error at UTF-8 encoded recipient
- Double quotes in Email subject are not fecthed HOT 1
- PostgreSQL fActiveRecord::populate sets auto_increment field to 0 as default
- Microsoft Outlook Web Access and certain attachments (Content-ID)
- fMailbox.php doesn't always split the references in to an array as expected
- listMessages() returned empty array due to trailing whitespace in IMAP response HOT 1
- Type: fConnectivityException Message
- Is the project dead? HOT 8
- Command Line Script HOT 1
- Database table have the specified column but script stop working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flourish-classes.