Welcome Guest, Not a member yet? Register   Sign In
Site online with db offline
#8

The intention is to do something in the catch block which is appropriate for your site, rather than allowing the error to be displayed to the user. You might choose to setup a boolean variable/property to tell the rest of the code not to use that particular database connection, or you might just return a value indicating to the calling function that the database wasn't available. The point is to prevent the site/page from going down just because the connection isn't available, but it's still up to you to make sure you don't try to use the connection.

In terms of how you handle the absence of the data that connection would have provided, that's also determined by what's appropriate for your site. You might choose to display a message where the data would have been displayed which says the data is not currently available, your you might not display anything.
Reply


Messages In This Thread
Site online with db offline - by StratoKyke - 11-12-2015, 04:46 PM
RE: Site online with db offline - by mwhitney - 11-13-2015, 09:44 AM
RE: Site online with db offline - by StratoKyke - 11-13-2015, 09:57 AM
RE: Site online with db offline - by mwhitney - 11-13-2015, 10:46 AM
RE: Site online with db offline - by StratoKyke - 11-13-2015, 11:00 AM
RE: Site online with db offline - by mwhitney - 11-13-2015, 11:24 AM
RE: Site online with db offline - by StratoKyke - 11-13-2015, 11:50 AM
RE: Site online with db offline - by mwhitney - 11-13-2015, 12:08 PM
RE: Site online with db offline - by StratoKyke - 11-13-2015, 12:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB