Link to home
Start Free TrialLog in
Avatar of christamcc
christamccFlag for United States of America

asked on

PHP How to show error message in "catch"

I have something like this:

function doThis() {
Try {
  //lots of stuff
  return $thething;
} catch (SpecialException Exception $ex) {
			die($ex->getMessage());
}	
};

Open in new window


And calling code:

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

$theThing = doThis();
//do stuff with $theThing;

}

Open in new window


How do I print the error upon die?

thanks!
ASKER CERTIFIED SOLUTION
Avatar of Barry62
Barry62
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Brad Brett