What is the point of using custom exception class in php?

kofar

New Member
In some libraries it is common practice to make custom Exception classes for every error condition, like:\[code\]class FileNotFound_Exception extends Exception {}\[/code\]You can handle certain type of Exception, however you cannot read all source code of all libraries to remember each Exception class, and cannot take full advantage of using custom Exceptions. Most of time I just catching them with base Exception class:\[code\]catch (Exception $e){ // log and display friendly error}\[/code\]Is there other ways to have benefit of custom Exception classes, without writing long list of catch blocks?I like Exceptions, but don't know how to use them properly. Thank you.
 
Back
Top