Skip to content

Commit

Permalink
util-app: Add visibility for NonFatal exceptions during exiting of an…
Browse files Browse the repository at this point in the history
… App

Summary: Problem

When exceptions occur in executing `c.t.app.App#close` they are mostly
swallowed -- the `closeOnExitLast` returns the first encountered exception.
However, there is no visibilty on any NonFatal exception from executing
registered `onExit` functions or closing `closeOnExit` Closables, nor over all
NonFatals from closing `closeOnExitLast` Closables.

Solution

Update the logic in `c.t.app.App#close` to allow for logging and collecting
NonFatal exceptions which occur during closing of the app. The collected
exceptions are finally thrown in the new CloseException.

Result

Users will get visibility into NonFatal exceptions which happen during closing
of the application through logging and collection of causes in a thrown
CloseException.

JIRA Issues: CSL-6040

Differential Revision: https://phabricator.twitter.biz/D146029
  • Loading branch information
cacoco authored and jenkins committed Mar 14, 2018
1 parent fa2990f commit 476e635
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class AdminHttpServerTest extends FunSuite with Eventually with IntegrationPatie
override protected lazy val shutdownTimer = new MockTimer

override protected def exitOnError(reason: String): Unit = ()
override protected def exitOnError(throwable: Throwable): Unit = ()

override def main(): Unit = {
val drainingClosable = Closable.make { _ =>
Expand Down

0 comments on commit 476e635

Please sign in to comment.