Commit ae823da9 authored by James Sedgwick's avatar James Sedgwick Committed by Andre Azevedo

exceptionStr(exception_wrapper)

Summary: for consistency with exception and exception_ptr functions provided in String.h

Test Plan: unit

Reviewed By: vloh@fb.com

Subscribers: trunkagent, folly-diffs@, yfeldblum

FB internal diff: D1905087

Tasks: 5961362

Signature: t1:1905087:1426101740:670ceab5140250bbecdd1247025d3d70b7774690
parent 66047c6a
......@@ -342,6 +342,11 @@ exception_wrapper make_exception_wrapper(Args&&... args) {
return ew;
}
// For consistency with exceptionStr() functions in String.h
inline fbstring exceptionStr(const exception_wrapper& ew) {
return ew.what();
}
/*
* try_and_catch is a simple replacement for try {} catch(){} that allows you to
* specify which derived exceptions you would like to catch and store in an
......
......@@ -221,3 +221,9 @@ TEST(ExceptionWrapper, non_std_exception_test) {
EXPECT_EQ(i, expected);
}
}
TEST(ExceptionWrapper, exceptionStr) {
auto ew = make_exception_wrapper<std::runtime_error>("argh");
EXPECT_EQ("std::runtime_error: argh", exceptionStr(ew));
}
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