GithubHelp home page GithubHelp logo

Comments (3)

uBizzy avatar uBizzy commented on July 23, 2024

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.

oliveratgithub avatar oliveratgithub commented on July 23, 2024

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.

uBizzy avatar uBizzy commented on July 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.