Skip to content

Commit

Permalink
Add special handling for UnavailableException
Browse files Browse the repository at this point in the history
This code adds special handling for javax.servelet.UnavailableException.
This exception is an idiomatic way to signal a full abort to the Java
Application server running the application.

Please see #1843 for more information.
  • Loading branch information
farmdawgnation committed Jun 11, 2017
1 parent aee83d8 commit 84b3853
Showing 1 changed file with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package net.liftweb
package http
package provider
package net.liftweb
package http
package provider

import net.liftweb.common._
import net.liftweb.util._
Expand Down Expand Up @@ -87,12 +87,29 @@ trait HTTPProvider {
preBoot
b.boot
} catch {
// The UnavailableException is the idiomatic way to tell a Java application container that
// the boot process has gone horribly, horribly wrong. That _must_ bubble to the application
// container that is invoking the app. See https://github.com/lift/framework/issues/1843
case unavailableException: javax.servlet.UnavailableException =>
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("********** Failed to Boot! An unavailable exception was thrown an all futher boot activities are aborted", unavailableException);
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")

throw unavailableException

case e: Exception =>
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("********** Failed to Boot! Your application may not run properly", e);
logger.error("********** Failed to Boot! Your application may not run properly", e);
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
logger.error("------------------------------------------------------------------")
Expand Down

0 comments on commit 84b3853

Please sign in to comment.