RE: error handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Personally, I create a custom error handler for all my apps (currently 4.3.*
compliant).  While I normally use Smarty and have separate error templates,
here is a quick example.

    function errorHandler($errno, $errstr, $errfile, $errline )
    {
        print "Error #: $errno <br/>Error Message: $error_Message";
    }  

    set_error_handler("errorHandler");

    call_some_pgsql_function();


-----Original Message-----
From: Cima [mailto:ruel.cima@xxxxxxxxxxxxxxxxx] 
Sent: Tuesday, April 12, 2005 11:46 PM
To: php
Subject:  error handling

hi,

im working with php 4 and postgresql 8 and i would like to know how to
handle certain errors generated. in postgresql,  i've written a stored
function that selects a record from a table and in case no record is found i
'raise an exception'. fine, now in my php script  i call that the stored
function which works properly when there is a record but when the record
doesnt exist, i would like to be able to place my own error message and not
e.g  'fatal error, .....'. how do i capture(in php)  the exception i raised
in postgres so that i know the record doesnt exist?


thanx.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux