Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7535917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:25:51+00:00 2026-05-30T06:25:51+00:00

A method performs a recursive scan for yaml files and parses them, extracts some

  • 0

A method performs a recursive scan for yaml files and parses them, extracts some of the information. I use sfYamlParser to parse the yaml. I enclosed the call to parse() in a try block and catch “Exception $e” but I still get a “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...') #3 

Why is the exception not caught by my catch block?
I did expect the Exception to bubble up and then be caught in my method.
The coe is namespaced 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:
#0 [...]/packages/fabpot-yaml/sfYamlParser.php(201): sfYamlParser-&gt;parse('type:         s...')
#1 [...]/packages/fabpot-yaml/sfYamlParser.php(201): sfYamlParser-&gt;parse('explicitPrivile...')
#2 [...]/packages/hydra/source/com/daliaIT/hydra/Indexer.php(20): sfYamlParser-&gt;parse('type:       com...')
#3 [...]/packages/co3/source/com/daliaIT/co3/PathHelper.php(97): com\daliaIT\hydra\{closure}('packages/hPacks...')
#4 [...]/packages/hydra/source/com/daliaIT/hydra/Indexer.php(28): com\daliaIT\co3\PathHelper-&gt;scanCallback('packages/hPacks...', 'hmd', Object(Closure))

EDIT:

Ok if I do not throw another exception I get no fatal error. Sorry I expected the code to crash with the error message I defined, not with the original exception messgae, so:

why doesnt it fail with “Parsing model definiion ‘$filePath’ failed.”?

EDIT:

Turns out PHP has an iteresting way to deal with uncaught exceptions:

If you throw an “new Exception(“MESSAGE”, 0,$previous_exception)” and do not catch it PHP will display the error message from $previous_exception and NOT “MESSAGE”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:25:53+00:00Added an answer on May 30, 2026 at 6:25 am

    Probably because you don’t catch the exception you throw in the catch block.

    You have to either stop throwing exception again in the catch block, or make a new try catch around / in the calling method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Official problem: Write Java method to perform recursive descent parse of the following production:
I have a small utility extension method that performs some null checks on some
I render some data based on a condition. The backing method performs a check
I have a generic class with a non generic static method that performs some
I have a .NET class library containing a class with a method that performs
So, I have a method that performs a parametrised LIKE query. The method takes
I've got a method that takes in an HttpRequest object and performs differently based
I’m trying to figure out whether FormsAuthentication.RedirectFromLoginPage (called inside method M() ), performs redirection
I have a method invoking bean which calls a method to perform some sort
Let's say you have a business logic method that can perform some operation across

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.