The method performs a recursive scan of yaml files and analyzes them, extracts some of the information. I am using sfYamlParser to analyze yaml. I included the parse () call in the try block and caught "Exception $ e", but I still get "Fatal error: uncaught exception".
try{ $definition = $parser->parse(file_get_contents($filePath));//line 20 } catch(Exception $e) { throw new Exception("Parsing model definiion '$filePath' failed.", 0, $e); }
Snippet from stack trace:
...Indexer.php(20): sfYamlParser->parse('type: com...')
Why didn't the exception get into my catch block? I expected Exception to start bubbling, and then get caught in my method. The coefficient is assigned to the names, but "Use Exception" is set.
Error messsage:
Fatal error</b>: Uncaught exception 'InvalidArgumentException' with message 'Unable to parse line 30 (key; true).' in [...]/packages/fabpot-yaml/sfYamlParser.php:265 Stack trace:
EDIT:
Well, if I don't throw another exception, I don't get a fatal error. Sorry, I was expecting the code to crash with the error message I defined, and not with the original exclusive messgae, so:
why doesn't it fail with "Parsing Model Definition" $ filePath "failed". ??
EDIT:
Turns out PHP has a fighter way to handle uncaught exceptions:
If you throw a "new exception" ("MESSAGE", 0, $ previous_exception) and don't catch it, PHP will display an error message from $ previous_exception and NOT "MESSAGE"