Tuesday, 15 May 2012

php - Understanding try catch block -


I'm confused about the whole block of effort I think the exception is thrown, so it's on the catch block Although I have a question about using the returns inside the block try.

  try {// other logic is here // it is in Larval and sends back the user and should stop the operation (foo! = Bar) {return Redirect :: back () - & gt; With_message ('This auction is off.', 'Error'); }} Hold (exception $ E) {return $ e- & gt; GetMessage (); }   

So my question is: Is it OK to end action within the block of action? Do I ever get an error, where the refund is ignored (or is considered as an exception?) And the code continues? Then, I'm very new to this.

Yes, this is a completely valid way of writing that code.

There is a rule where your code will be running after control, exit code from try or hold PHP 5.5, which in the end < Finally, block> from other languages, and can be used to run a cleanup code, which is always executed after the try block, even if an exception is thrown or not.

But you're probably not using 5.5.

No comments:

Post a Comment