• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Try-Catch

#1
[eluser]DDDD[/eluser]
How can I use native PHP exceptions in codeigniter? Using <code>try-catch</code> in the controller generates the following error => Fatal error: Class 'execption' not found in ...

#2
[eluser]PhilTem[/eluser]
Then you're code seems to be wrong. If have several parts where I use

Code:
try
{
  // something
}
catch ( Exception $e )
{
  // Do something with exception
}

and it works pretty good Wink

Did you use 'Exception' or 'exception'?

#3
[eluser]DDDD[/eluser]
I am using the following block:
<code>
try{

}catch(Exception $e){

}
</code>

But it generates an error indicating that there is not a class "Exception". Do you have any suggestions?

#4
[eluser]DDDD[/eluser]
reformulating the code:
<code>
try{
throw new Execption('test');
}catch(Exception $e){

}
</code>

#5
[eluser]InsiteFX[/eluser]
Code:
try
{
    // code here!
    echo 'Success';
}
catch (Exception $e)
{
    echo 'Caught exception: ',  $e->getMessage(), "\n";
}


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.