Handle nullptr from getTimekeeperSingleton
authorCameron Pickett <pickett@fb.com>
Tue, 10 Oct 2017 09:39:20 +0000 (02:39 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 10 Oct 2017 09:56:55 +0000 (02:56 -0700)
commitd1c5974be19dcdcbf4f490eabd994fdc78da6086
tree1fdd4f7cecd4a53a4382f66ff9d935774f7b90f5
parentfbc4c23895b0ee3874d9a36401d580a2a8957ba9
Handle nullptr from getTimekeeperSingleton

Summary:
According to folly::Singleton::try_get(), https://fburl.com/23wqby9i, the caller is responsible for handling a nullptr return. In this case, we handle it poorly, via a crash both in production and debug code.

This diff opts for handling the nullptr more gracefully, via a future loaded with an exception.

Reviewed By: yfeldblum

Differential Revision: D6006864

fbshipit-source-id: e8fde57ed161b33fa1f157ce663ed85e69640c25
folly/futures/Future.cpp
folly/futures/FutureException.h
folly/futures/test/TimekeeperTest.cpp