Skip to content

Instantly share code, notes, and snippets.

@bkrall
Last active December 19, 2015 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bkrall/6011848 to your computer and use it in GitHub Desktop.
Save bkrall/6011848 to your computer and use it in GitHub Desktop.
No exception object returned by a failed call
function _modulename_getData($field, $table) {
try {
if (empty($field)) {
throw new Exception("The field is undefined.");
}
// rest of code here...
}
catch (Exception $e) {
/*
Here you can either echo the exception message like:
echo $e->getMessage();
Or you can throw the Exception Object $e like:
throw $e;
*/
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment