Commit 01f69815 authored by Lucian Grijincu's avatar Lucian Grijincu Committed by Sara Golemon

folly: improve Subprocess::enforce() error message

Summary: Previous implementation only printed the desired state, not the actual runtime state. Fix that.

Test Plan: n/a

Reviewed By: tudorb@fb.com

FB internal diff: D936279
parent 5ab723e5
...@@ -54,9 +54,11 @@ ProcessReturnCode::State ProcessReturnCode::state() const { ...@@ -54,9 +54,11 @@ ProcessReturnCode::State ProcessReturnCode::state() const {
"Invalid ProcessReturnCode: ", rawStatus_)); "Invalid ProcessReturnCode: ", rawStatus_));
} }
void ProcessReturnCode::enforce(State s) const { void ProcessReturnCode::enforce(State expected) const {
if (state() != s) { State s = state();
throw std::logic_error(to<std::string>("Invalid state ", s)); if (s != expected) {
throw std::logic_error(to<std::string>("Invalid state ", s,
" expected ", expected));
} }
} }
......
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