Jump to content

Exception Handling and Exception Class


random1

Recommended Posts

How do you create your own Exception class in PHP?

 

My base programming language is Java, I can do it in that but I'm still pretty new PHP.

 

Can you create you an Exception class that catches it's own exceptions e.g. 'CustomException cex' ?

 

Also how do I make that code available to all other pages and classes in my project?

Link to comment
https://forums.phpfreaks.com/topic/95041-exception-handling-and-exception-class/
Share on other sites

And parent::__destruct if you override the destructor :)

 

You don't need to REPLACE the exception class - just extend it. Don't re-make it's existing methods unless you need to do something totally different. If it's only a little different, you can probably still use the existing method within one of your own

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.