Quantcast
Channel: User Hubro - Stack Overflow
Viewing all articles
Browse latest Browse all 42

Why isn't my Exception being caught by catch? [duplicate]

$
0
0

I have some code that looks like this

# Try to import filetry{    DataManager::fileImport($_FILES['datafile']['tmp_name'],                             $_POST['zones'], $_POST['statuses']);}catch(Exception $e){    print 'Herp.';    $response->body = Helpers::getVarDump($e);}

DataManager::fileImport is literally a one-line function that throws a normal Exception:

static function fileImport($filepath, $zones, $statuses){    throw new Exception('SOME EXCEPTION');}

And yet I get

Fatal error: Uncaught exception 'Exception' with message 'SOME EXCEPTION'...

From the try block. Also 'Herp.' is never printed. Why doesn't the Exception trigger the catch block?


EDIT: I should mention I'm using Tonic and PHP 5.3.9

EDIT AGAIN: Here's DataManager (with names replaced with ... for anonymity) http://pastebin.com/daHWBJDC


Viewing all articles
Browse latest Browse all 42

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>