Helper method to get exception type
authorHitesh Khandelwal <hitesh@fb.com>
Fri, 20 Dec 2013 19:02:23 +0000 (11:02 -0800)
committerJordan DeLong <jdelong@fb.com>
Fri, 20 Dec 2013 21:08:19 +0000 (13:08 -0800)
Test Plan: Tested with subsequent thrift diff

Reviewed By: davejwatson@fb.com

FB internal diff: D1108428

folly/String.h

index da93cd265d106a296e60a651aad59cd1cfb16bfd..e0790f54e24a1ff3de452e130b6b9434e5c6ba09 100644 (file)
@@ -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<fbstring>(demangle(typeid(e)));
+}
+
 /**
  * Debug string for an exception: include type and what().
  */