Commit c715a583 authored by Chip Turner's avatar Chip Turner Committed by Sara Golemon

Improve messaging when registrationComplete hasn't been called

Summary:
The previous message from CHECK_THROW was difficult to debug.
This improves the messaging to be more actionable.

Test Plan: runtests

Reviewed By: lins@fb.com

Subscribers: lins, anca, fugalh

FB internal diff: D1483915
parent 9b4749fd
......@@ -138,7 +138,12 @@ class SingletonVault {
// Retrieve a singleton from the vault, creating it if necessary.
std::shared_ptr<void> get_shared(const std::type_info& type) {
std::unique_lock<std::mutex> lock(mutex_);
CHECK_THROW(state_ == SingletonVaultState::Running, std::logic_error);
if (state_ != SingletonVaultState::Running) {
throw std::logic_error(
"Attempt to load a singleton before "
"SingletonVault::registrationComplete was called (hint: you probably "
"didn't call initFacebook)");
}
auto it = singletons_.find(type);
if (it == singletons_.end()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment