Does that mean for every exception do we have to write
our custom exception and describe it from our own
message

If you mean "Do I have to write custom exception classes?", the no. You could just use the PHP Exception class.

Eg.

class DBException extends Exception {}

try {
    $connection = mysql_connect(...);

    if (!$connection) {
        throw new DBException('Failed to connect to database');
    }

// Database exception handling code
} catch (DBException $e) {
    // ...

// Generic Exception handling code (The Exception c
} catch Exception $e {
    // ...
}

That's from memory, so there may be a few errors.

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and Helpdesk software for £299 hosted for you -
no installation, no maintenance, new features automatic and free

             ** New Helpdesk demo now available **

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

Reply via email to