09-09-2012, 08:39 PM
[eluser]Unknown[/eluser]
Hi guys,
Long time user of CodeIgniter, first time poster.
I'm starting the build of a new small application and I'm trying to implement more exceptions and exception handling into my code where they should be.
My goal is to have a range of exception sub classes that I can throw and handle in various scenarios. They will be fairly descriptively named.
In a standard php app you can imagine my goal could be achieved by having a file included with a few examples like below:
My question is how do I go about this in CodeIgniter?
I've been reading the docs (http://ellislab.com/codeigniter/user-gui...asses.html) and I don't want to extend the CI_Exceptions class with a single My_Exceptions class, because I need multiple.
I also read this post from someone who was wanting what I'm after, but there was no resolution http://ellislab.com/forums/viewthread/67096/
The guy that came the closest was http://ellislab.com/forums/viewreply/952628/ but that still doesn't seem like the nicest way of doing things.
Is there a better way of handling this? Short of adding a seperate exception library class and including it with the autoloader?
Thanks guys
Hi guys,
Long time user of CodeIgniter, first time poster.
I'm starting the build of a new small application and I'm trying to implement more exceptions and exception handling into my code where they should be.
My goal is to have a range of exception sub classes that I can throw and handle in various scenarios. They will be fairly descriptively named.
In a standard php app you can imagine my goal could be achieved by having a file included with a few examples like below:
Code:
class PatientIDNotExistsException extends Exception {}
class PatientFailedToSyncException extends Exception {}
class WebServiceAuthFailedException extends Exception {}
My question is how do I go about this in CodeIgniter?
I've been reading the docs (http://ellislab.com/codeigniter/user-gui...asses.html) and I don't want to extend the CI_Exceptions class with a single My_Exceptions class, because I need multiple.
I also read this post from someone who was wanting what I'm after, but there was no resolution http://ellislab.com/forums/viewthread/67096/
The guy that came the closest was http://ellislab.com/forums/viewreply/952628/ but that still doesn't seem like the nicest way of doing things.
Is there a better way of handling this? Short of adding a seperate exception library class and including it with the autoloader?
Thanks guys