Advertisement
pteague

ugh, really?

Aug 18th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. <?php
  2. try {
  3.     $validation_exception = null;
  4.     ...
  5.     if($thingThatShouldCauseException) {
  6.         $validation_exception = new Exception('blah blah', 0, $validation_exception);
  7.     }
  8.     ...
  9.     if($thingThatShouldCauseException) {
  10.         $validation_exception = new Exception('blah blah', 0, $validation_exception);
  11.     }
  12.     ...
  13.     if ($validation_exception !== null){
  14.         throw $validation_exception;
  15.     }
  16.     ...
  17. }
  18. catch(Exception e){
  19.     echo "\nError(s) encountered while processing file:\n";
  20.     do{
  21.         echo "\t".$e->getMessage()."\n";
  22.     }while($e = $e->getPrevious());
  23.     echo "\n";
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement