From 799322db5c1274cd7180e5cc5a5d992bd0388165 Mon Sep 17 00:00:00 2001 From: Hitesh Khandelwal Date: Fri, 20 Dec 2013 11:02:23 -0800 Subject: [PATCH] Helper method to get exception type Test Plan: Tested with subsequent thrift diff Reviewed By: davejwatson@fb.com FB internal diff: D1108428 --- folly/String.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/folly/String.h b/folly/String.h index da93cd26..e0790f54 100644 --- a/folly/String.h +++ b/folly/String.h @@ -352,6 +352,13 @@ inline size_t demangle(const std::type_info& type, char* buf, size_t bufSize) { return demangle(type.name(), buf, bufSize); } +/** + * Debug string for an exception: include type only. + */ +inline fbstring exceptionTypeStr(const std::exception& e) { + return folly::to(demangle(typeid(e))); +} + /** * Debug string for an exception: include type and what(). */ -- 2.34.1