Why isn't my Exception being caught by catch?












18















I have some code that looks like this



# Try to import file
try
{
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










share|improve this question




















  • 1





    It should work. Are you perhaps not showing actual code, and throwing some RandomLyNamedException which does not extend Exception?

    – Wrikken
    Feb 1 '12 at 14:21











  • This is the actual code

    – Hubro
    Feb 1 '12 at 14:21











  • This looks correct. Are you sure that this is the only place where you are calling this fileImport method? If there are others, I would make sure they are also being caught.

    – Zack Marrapese
    Feb 1 '12 at 14:23






  • 1





    If using 5.3+, did you check your namespaces?

    – Sander Marechal
    Feb 1 '12 at 14:24











  • I just made the class and that's the only place the function is being called. I also checked the line number in the stack trace

    – Hubro
    Feb 1 '12 at 14:24
















18















I have some code that looks like this



# Try to import file
try
{
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










share|improve this question




















  • 1





    It should work. Are you perhaps not showing actual code, and throwing some RandomLyNamedException which does not extend Exception?

    – Wrikken
    Feb 1 '12 at 14:21











  • This is the actual code

    – Hubro
    Feb 1 '12 at 14:21











  • This looks correct. Are you sure that this is the only place where you are calling this fileImport method? If there are others, I would make sure they are also being caught.

    – Zack Marrapese
    Feb 1 '12 at 14:23






  • 1





    If using 5.3+, did you check your namespaces?

    – Sander Marechal
    Feb 1 '12 at 14:24











  • I just made the class and that's the only place the function is being called. I also checked the line number in the stack trace

    – Hubro
    Feb 1 '12 at 14:24














18












18








18


1






I have some code that looks like this



# Try to import file
try
{
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










share|improve this question
















I have some code that looks like this



# Try to import file
try
{
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







php exception






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 1 '12 at 14:28







Hubro

















asked Feb 1 '12 at 14:18









HubroHubro

26.1k41165309




26.1k41165309








  • 1





    It should work. Are you perhaps not showing actual code, and throwing some RandomLyNamedException which does not extend Exception?

    – Wrikken
    Feb 1 '12 at 14:21











  • This is the actual code

    – Hubro
    Feb 1 '12 at 14:21











  • This looks correct. Are you sure that this is the only place where you are calling this fileImport method? If there are others, I would make sure they are also being caught.

    – Zack Marrapese
    Feb 1 '12 at 14:23






  • 1





    If using 5.3+, did you check your namespaces?

    – Sander Marechal
    Feb 1 '12 at 14:24











  • I just made the class and that's the only place the function is being called. I also checked the line number in the stack trace

    – Hubro
    Feb 1 '12 at 14:24














  • 1





    It should work. Are you perhaps not showing actual code, and throwing some RandomLyNamedException which does not extend Exception?

    – Wrikken
    Feb 1 '12 at 14:21











  • This is the actual code

    – Hubro
    Feb 1 '12 at 14:21











  • This looks correct. Are you sure that this is the only place where you are calling this fileImport method? If there are others, I would make sure they are also being caught.

    – Zack Marrapese
    Feb 1 '12 at 14:23






  • 1





    If using 5.3+, did you check your namespaces?

    – Sander Marechal
    Feb 1 '12 at 14:24











  • I just made the class and that's the only place the function is being called. I also checked the line number in the stack trace

    – Hubro
    Feb 1 '12 at 14:24








1




1





It should work. Are you perhaps not showing actual code, and throwing some RandomLyNamedException which does not extend Exception?

– Wrikken
Feb 1 '12 at 14:21





It should work. Are you perhaps not showing actual code, and throwing some RandomLyNamedException which does not extend Exception?

– Wrikken
Feb 1 '12 at 14:21













This is the actual code

– Hubro
Feb 1 '12 at 14:21





This is the actual code

– Hubro
Feb 1 '12 at 14:21













This looks correct. Are you sure that this is the only place where you are calling this fileImport method? If there are others, I would make sure they are also being caught.

– Zack Marrapese
Feb 1 '12 at 14:23





This looks correct. Are you sure that this is the only place where you are calling this fileImport method? If there are others, I would make sure they are also being caught.

– Zack Marrapese
Feb 1 '12 at 14:23




1




1





If using 5.3+, did you check your namespaces?

– Sander Marechal
Feb 1 '12 at 14:24





If using 5.3+, did you check your namespaces?

– Sander Marechal
Feb 1 '12 at 14:24













I just made the class and that's the only place the function is being called. I also checked the line number in the stack trace

– Hubro
Feb 1 '12 at 14:24





I just made the class and that's the only place the function is being called. I also checked the line number in the stack trace

– Hubro
Feb 1 '12 at 14:24












4 Answers
4






active

oldest

votes


















43














Solution



I neglected to specify use Exception; in the file containing the try/catch.



Pondering



I know it's intentional that each namespace in PHP should define its own Exception for many reasons, but I still find it odd that catch(Exception e) didn't cause any errors when Exception in that context wasn't defined. If I were to write new Exception() I would get an error.



Oh well, at least I learned something.






share|improve this answer


























  • That is odd. Thanks for figuring this out. I come from a Java background and was completely lost as to why the try catch block wasn't interception an Exception.

    – James P.
    Aug 10 '13 at 0:25











  • Lol ... I just realized I'd left an exception handler in my data class. This explains that :p

    – James P.
    Aug 10 '13 at 0:28






  • 2





    Phew! Thanks for answering your own question. Not finding that out would have been a pain.

    – crantok
    Feb 18 '15 at 14:03











  • Just use Exception; will work. Imports by default import from the global namespace.

    – Jason
    Oct 4 '18 at 14:16



















3














Strange. If i run this code i get the "Herp."



<?php

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

# Try to import file
try
{
DataManagerTest::fileImport("param1","param2","param3");
}
catch(Exception $e)
{
print 'Herp.';
}


?>





share|improve this answer
























  • That's pretty much identical to what I'm running. The only notable differences is that my class is in a separate file and namespace

    – Hubro
    Feb 1 '12 at 14:29



















1














You might have an issue with your DataManager class because i copied your code, adapted it to run and i get the exception handled... You problem is elsewhere...



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

try{
DataManager::fileImport('', '', '');
}catch(Exception $e){
print 'Herp.';
}


Results in



Herp.





share|improve this answer
























  • hehe. nice post m8 ;)

    – Andreas Helgegren
    Feb 1 '12 at 14:24



















0














4 years later...



@Hubro, thank you for saving me with that namespace fix!



It does seem counterintuitive at first that it's necessary when throwing a root-level Exception, even though it ultimately makes sense in the general context of namespaces.



For anyone who doesn't want to utilize @Hubro's file-level fix:



use Exception;



You could instead add the backslash in front of Exception in the higher level catch block:



} catch (Exception $e) {



We could all benefit from someone smarter than me providing suggestions on best practices around defining a custom Exception for each namespace. Any takers?






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f9097345%2fwhy-isnt-my-exception-being-caught-by-catch%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    43














    Solution



    I neglected to specify use Exception; in the file containing the try/catch.



    Pondering



    I know it's intentional that each namespace in PHP should define its own Exception for many reasons, but I still find it odd that catch(Exception e) didn't cause any errors when Exception in that context wasn't defined. If I were to write new Exception() I would get an error.



    Oh well, at least I learned something.






    share|improve this answer


























    • That is odd. Thanks for figuring this out. I come from a Java background and was completely lost as to why the try catch block wasn't interception an Exception.

      – James P.
      Aug 10 '13 at 0:25











    • Lol ... I just realized I'd left an exception handler in my data class. This explains that :p

      – James P.
      Aug 10 '13 at 0:28






    • 2





      Phew! Thanks for answering your own question. Not finding that out would have been a pain.

      – crantok
      Feb 18 '15 at 14:03











    • Just use Exception; will work. Imports by default import from the global namespace.

      – Jason
      Oct 4 '18 at 14:16
















    43














    Solution



    I neglected to specify use Exception; in the file containing the try/catch.



    Pondering



    I know it's intentional that each namespace in PHP should define its own Exception for many reasons, but I still find it odd that catch(Exception e) didn't cause any errors when Exception in that context wasn't defined. If I were to write new Exception() I would get an error.



    Oh well, at least I learned something.






    share|improve this answer


























    • That is odd. Thanks for figuring this out. I come from a Java background and was completely lost as to why the try catch block wasn't interception an Exception.

      – James P.
      Aug 10 '13 at 0:25











    • Lol ... I just realized I'd left an exception handler in my data class. This explains that :p

      – James P.
      Aug 10 '13 at 0:28






    • 2





      Phew! Thanks for answering your own question. Not finding that out would have been a pain.

      – crantok
      Feb 18 '15 at 14:03











    • Just use Exception; will work. Imports by default import from the global namespace.

      – Jason
      Oct 4 '18 at 14:16














    43












    43








    43







    Solution



    I neglected to specify use Exception; in the file containing the try/catch.



    Pondering



    I know it's intentional that each namespace in PHP should define its own Exception for many reasons, but I still find it odd that catch(Exception e) didn't cause any errors when Exception in that context wasn't defined. If I were to write new Exception() I would get an error.



    Oh well, at least I learned something.






    share|improve this answer















    Solution



    I neglected to specify use Exception; in the file containing the try/catch.



    Pondering



    I know it's intentional that each namespace in PHP should define its own Exception for many reasons, but I still find it odd that catch(Exception e) didn't cause any errors when Exception in that context wasn't defined. If I were to write new Exception() I would get an error.



    Oh well, at least I learned something.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 15 '15 at 8:56

























    answered Feb 1 '12 at 15:04









    HubroHubro

    26.1k41165309




    26.1k41165309













    • That is odd. Thanks for figuring this out. I come from a Java background and was completely lost as to why the try catch block wasn't interception an Exception.

      – James P.
      Aug 10 '13 at 0:25











    • Lol ... I just realized I'd left an exception handler in my data class. This explains that :p

      – James P.
      Aug 10 '13 at 0:28






    • 2





      Phew! Thanks for answering your own question. Not finding that out would have been a pain.

      – crantok
      Feb 18 '15 at 14:03











    • Just use Exception; will work. Imports by default import from the global namespace.

      – Jason
      Oct 4 '18 at 14:16



















    • That is odd. Thanks for figuring this out. I come from a Java background and was completely lost as to why the try catch block wasn't interception an Exception.

      – James P.
      Aug 10 '13 at 0:25











    • Lol ... I just realized I'd left an exception handler in my data class. This explains that :p

      – James P.
      Aug 10 '13 at 0:28






    • 2





      Phew! Thanks for answering your own question. Not finding that out would have been a pain.

      – crantok
      Feb 18 '15 at 14:03











    • Just use Exception; will work. Imports by default import from the global namespace.

      – Jason
      Oct 4 '18 at 14:16

















    That is odd. Thanks for figuring this out. I come from a Java background and was completely lost as to why the try catch block wasn't interception an Exception.

    – James P.
    Aug 10 '13 at 0:25





    That is odd. Thanks for figuring this out. I come from a Java background and was completely lost as to why the try catch block wasn't interception an Exception.

    – James P.
    Aug 10 '13 at 0:25













    Lol ... I just realized I'd left an exception handler in my data class. This explains that :p

    – James P.
    Aug 10 '13 at 0:28





    Lol ... I just realized I'd left an exception handler in my data class. This explains that :p

    – James P.
    Aug 10 '13 at 0:28




    2




    2





    Phew! Thanks for answering your own question. Not finding that out would have been a pain.

    – crantok
    Feb 18 '15 at 14:03





    Phew! Thanks for answering your own question. Not finding that out would have been a pain.

    – crantok
    Feb 18 '15 at 14:03













    Just use Exception; will work. Imports by default import from the global namespace.

    – Jason
    Oct 4 '18 at 14:16





    Just use Exception; will work. Imports by default import from the global namespace.

    – Jason
    Oct 4 '18 at 14:16













    3














    Strange. If i run this code i get the "Herp."



    <?php

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

    # Try to import file
    try
    {
    DataManagerTest::fileImport("param1","param2","param3");
    }
    catch(Exception $e)
    {
    print 'Herp.';
    }


    ?>





    share|improve this answer
























    • That's pretty much identical to what I'm running. The only notable differences is that my class is in a separate file and namespace

      – Hubro
      Feb 1 '12 at 14:29
















    3














    Strange. If i run this code i get the "Herp."



    <?php

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

    # Try to import file
    try
    {
    DataManagerTest::fileImport("param1","param2","param3");
    }
    catch(Exception $e)
    {
    print 'Herp.';
    }


    ?>





    share|improve this answer
























    • That's pretty much identical to what I'm running. The only notable differences is that my class is in a separate file and namespace

      – Hubro
      Feb 1 '12 at 14:29














    3












    3








    3







    Strange. If i run this code i get the "Herp."



    <?php

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

    # Try to import file
    try
    {
    DataManagerTest::fileImport("param1","param2","param3");
    }
    catch(Exception $e)
    {
    print 'Herp.';
    }


    ?>





    share|improve this answer













    Strange. If i run this code i get the "Herp."



    <?php

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

    # Try to import file
    try
    {
    DataManagerTest::fileImport("param1","param2","param3");
    }
    catch(Exception $e)
    {
    print 'Herp.';
    }


    ?>






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Feb 1 '12 at 14:24









    Andreas HelgegrenAndreas Helgegren

    1,390911




    1,390911













    • That's pretty much identical to what I'm running. The only notable differences is that my class is in a separate file and namespace

      – Hubro
      Feb 1 '12 at 14:29



















    • That's pretty much identical to what I'm running. The only notable differences is that my class is in a separate file and namespace

      – Hubro
      Feb 1 '12 at 14:29

















    That's pretty much identical to what I'm running. The only notable differences is that my class is in a separate file and namespace

    – Hubro
    Feb 1 '12 at 14:29





    That's pretty much identical to what I'm running. The only notable differences is that my class is in a separate file and namespace

    – Hubro
    Feb 1 '12 at 14:29











    1














    You might have an issue with your DataManager class because i copied your code, adapted it to run and i get the exception handled... You problem is elsewhere...



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

    try{
    DataManager::fileImport('', '', '');
    }catch(Exception $e){
    print 'Herp.';
    }


    Results in



    Herp.





    share|improve this answer
























    • hehe. nice post m8 ;)

      – Andreas Helgegren
      Feb 1 '12 at 14:24
















    1














    You might have an issue with your DataManager class because i copied your code, adapted it to run and i get the exception handled... You problem is elsewhere...



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

    try{
    DataManager::fileImport('', '', '');
    }catch(Exception $e){
    print 'Herp.';
    }


    Results in



    Herp.





    share|improve this answer
























    • hehe. nice post m8 ;)

      – Andreas Helgegren
      Feb 1 '12 at 14:24














    1












    1








    1







    You might have an issue with your DataManager class because i copied your code, adapted it to run and i get the exception handled... You problem is elsewhere...



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

    try{
    DataManager::fileImport('', '', '');
    }catch(Exception $e){
    print 'Herp.';
    }


    Results in



    Herp.





    share|improve this answer













    You might have an issue with your DataManager class because i copied your code, adapted it to run and i get the exception handled... You problem is elsewhere...



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

    try{
    DataManager::fileImport('', '', '');
    }catch(Exception $e){
    print 'Herp.';
    }


    Results in



    Herp.






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Feb 1 '12 at 14:23









    Mathieu DumoulinMathieu Dumoulin

    9,82253261




    9,82253261













    • hehe. nice post m8 ;)

      – Andreas Helgegren
      Feb 1 '12 at 14:24



















    • hehe. nice post m8 ;)

      – Andreas Helgegren
      Feb 1 '12 at 14:24

















    hehe. nice post m8 ;)

    – Andreas Helgegren
    Feb 1 '12 at 14:24





    hehe. nice post m8 ;)

    – Andreas Helgegren
    Feb 1 '12 at 14:24











    0














    4 years later...



    @Hubro, thank you for saving me with that namespace fix!



    It does seem counterintuitive at first that it's necessary when throwing a root-level Exception, even though it ultimately makes sense in the general context of namespaces.



    For anyone who doesn't want to utilize @Hubro's file-level fix:



    use Exception;



    You could instead add the backslash in front of Exception in the higher level catch block:



    } catch (Exception $e) {



    We could all benefit from someone smarter than me providing suggestions on best practices around defining a custom Exception for each namespace. Any takers?






    share|improve this answer




























      0














      4 years later...



      @Hubro, thank you for saving me with that namespace fix!



      It does seem counterintuitive at first that it's necessary when throwing a root-level Exception, even though it ultimately makes sense in the general context of namespaces.



      For anyone who doesn't want to utilize @Hubro's file-level fix:



      use Exception;



      You could instead add the backslash in front of Exception in the higher level catch block:



      } catch (Exception $e) {



      We could all benefit from someone smarter than me providing suggestions on best practices around defining a custom Exception for each namespace. Any takers?






      share|improve this answer


























        0












        0








        0







        4 years later...



        @Hubro, thank you for saving me with that namespace fix!



        It does seem counterintuitive at first that it's necessary when throwing a root-level Exception, even though it ultimately makes sense in the general context of namespaces.



        For anyone who doesn't want to utilize @Hubro's file-level fix:



        use Exception;



        You could instead add the backslash in front of Exception in the higher level catch block:



        } catch (Exception $e) {



        We could all benefit from someone smarter than me providing suggestions on best practices around defining a custom Exception for each namespace. Any takers?






        share|improve this answer













        4 years later...



        @Hubro, thank you for saving me with that namespace fix!



        It does seem counterintuitive at first that it's necessary when throwing a root-level Exception, even though it ultimately makes sense in the general context of namespaces.



        For anyone who doesn't want to utilize @Hubro's file-level fix:



        use Exception;



        You could instead add the backslash in front of Exception in the higher level catch block:



        } catch (Exception $e) {



        We could all benefit from someone smarter than me providing suggestions on best practices around defining a custom Exception for each namespace. Any takers?







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 30 '18 at 20:24









        John T.John T.

        514




        514






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f9097345%2fwhy-isnt-my-exception-being-caught-by-catch%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Can I use Tabulator js library in my java Spring + Thymeleaf project?