Re: [metabase-dev] Re: Error Handling?
On 11/26/2003 10:43 AM, deathbycarrots wrote:
>>This example should send you a e-mail message reporting the error
> Thanks for the example! I'll likely switch to that (or something
> similar) as soon as the website is launched. For now, I'm debugging
> to the browser.
If you are using PHP 4.3 or better, you may also want to take a look at
a PHP error handler that I wrote to include with a class that mails PHP
error logs to the system administrator or a developer for prompt
assistance. This class lets you track fatal errors that is impossible
for normal PHP scripts to catch.
The error handler function that I provide is capable of including a
backtrace of all the functions that called the function where the error
ocurred. You can use PHP trigger_error() function for your Metabase
error handler code or just adapt this error handler to have a better
notion where your errors occurred including the function names and
arguments. This should satisfy also the request of a developer that
wanted to know which query as failed.
> One more question....
> I'm a tad confused where the documentation suggests that I can make
> direct API calls rather than using the functions...
> for example:
> Or I can use:
> The former method, using an object, seems to have additional
> documentation missing for some reason. Is it *really* as easy as it
> says where I only need to use MetabaseSetupDatabaseObject and then
> refer to $db (or whatever I call it) as an OOP-style programming
> interface? I guess I could just try it out and see what happens, but
> I figured I would tap into your knowledge and get the answers from the
> source! :)
The procedural interface is just a wrapper around the direct to object
API. They call the same functions so they have the same arguments, apart
from the $database handler argument that is converted into the $db object.
Free ready to use OOP components written in PHP