php - can a Try Catch work within a Catch -


i've got try catch in framework i'm using when catch triggered displays error report page, 1 thing in report page displays menu times came database

what thought it's i'd put try catch in catch in case if database can connected to, this

try {     code throw excpetion } catch(exception $e) {     try     {         connect database         run query         log error in database         output screen using database data     }     catch(exception $e)     {         output screen using static html     } } 

this way if exception database connection error use static html output rather dynamic 1 generated database data

however when cause database error (deleting required table) static html doesn't work

i wondering if possible try catch work in catch or weather it's framework (i'm using magento), ask because if possible done i'll spend time figuring out why framework stopping me

yes, possible put try/catch block in catch block.

however, description, sounds want more 'intelligent' exception catching. can this:

try {     // operations including database } catch (databaseexception $e) {     // exception thrown code above databaseexception     // output error message without using database } catch (exception $e) {     // exception thrown code above have been type of exception except databaseexception     // can still try use database compose error message } 

note can throw exceptions can throw these exceptions when run catch block. example, when try block throws exception before reaches database code, database exception can still occur when handling original, non-database, exception.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -