• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exception handling

How do I setup Exception handling in CI?

For instance: If I get a unique key violation exception, I want to send the message back to the view that the user was working on instead of a different error page. How do I do that?

MyModel extends Model{

function register() {
  try {
  catch(Exception $e)
    // Here I wamt to catch log the message and send it back to the controller or view?



[eluser]Michael Wales[/eluser]
I usually use flashdata and a redirect to the same controller (which would then echo out that flashdata variable).

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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