From: Lucian Grijincu Date: Tue, 20 Aug 2013 22:50:39 +0000 (-0700) Subject: folly: improve Subprocess::enforce() error message X-Git-Tag: v0.22.0~897 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=01f69815fd9ae5ca7f8183b0c7862eccd46166af;p=folly.git 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 --- diff --git a/folly/Subprocess.cpp b/folly/Subprocess.cpp index fb4c19a9..846076dd 100644 --- a/folly/Subprocess.cpp +++ b/folly/Subprocess.cpp @@ -54,9 +54,11 @@ ProcessReturnCode::State ProcessReturnCode::state() const { "Invalid ProcessReturnCode: ", rawStatus_)); } -void ProcessReturnCode::enforce(State s) const { - if (state() != s) { - throw std::logic_error(to("Invalid state ", s)); +void ProcessReturnCode::enforce(State expected) const { + State s = state(); + if (s != expected) { + throw std::logic_error(to("Invalid state ", s, + " expected ", expected)); } }