Welcome Guest, Not a member yet? Register   Sign In
Multiple Exception Sub Classes With CodeIgniter
#1

[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:
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


Messages In This Thread
Multiple Exception Sub Classes With CodeIgniter - by El Forum - 09-09-2012, 08:39 PM
Multiple Exception Sub Classes With CodeIgniter - by El Forum - 09-10-2012, 05:06 PM
Multiple Exception Sub Classes With CodeIgniter - by El Forum - 09-11-2012, 03:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB