Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Exception in the Module
I have question regarding exception in the module.
It seems to me that I cannot use Exception in the module.
I am getting following.
Fatal Error - Class 'Test\Exception' not found
To throw an Exception, Do I have to use HttpServerErrorException written in the document?
Of course you can, as long as you take into account the namespaces your current class is in, and the namespace your exception class is in.
Assuming, with the little info you have given, that "Test" is the namespace of your module, and "Exception" is the standard PHP exception class, you need to use
throw new \Exception('load this from the global namespace');
If you don't add the leading backslash, PHP will try to find the class in the current namespace, where it doesn't exist.
Thanks a lot.
I will check that out.
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion