Welcome Guest, Not a member yet? Register   Sign In
custom Exceptions
#1

[eluser]Unknown[/eluser]
I work with PHP5 and I want to know how can I use custom class MyException like this :

Code:
class MyException  extends Exception { ... }

I don't know where to put my class file, and how to use It like in any other php project :

Code:
throw new MyException("My custom Message");


If someone could help me...
#2

[eluser]Doosje[/eluser]
I think it's
Code:
My_Exception extends .............

(It's somewhere in the config file .. Extending core classes)
#3

[eluser]Unknown[/eluser]
i created a file in a new plugin directory (in the app) named the file MyException_pi.php and loaded it in the config file.
#4

[eluser]Merolen[/eluser]
In the config.php it sais

Code:
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries.  For more information please see the user guide:
|
| http://ellislab.com/codeigniter/user-guide/general/core_classes.html
| http://ellislab.com/codeigniter/user-guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';

Have you looked into this?
#5

[eluser]adamp1[/eluser]
My best thought of where to put the MY_Exception class would be in application/libraries.




Theme © iAndrew 2016 - Forum software by © MyBB