remove always true if-predicate (gcc-5 -Wlogical-op)
[folly.git] / folly / ExceptionWrapper.cpp
index 8fce7574b9e25366be758f09445f27e6900a286c..d819c603e269ccfc812708931b2e605eb24177a8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -36,8 +36,10 @@ fbstring exception_wrapper::class_name() const {
   if (item_) {
     auto& i = *item_;
     return demangle(typeid(i));
-  } else if (eptr_) {
-    return ename_;
+  } else if (eptr_ && eobj_) {
+    return demangle(typeid(*eobj_));
+  } else if (eptr_ && etype_) {
+    return demangle(*etype_);
   } else {
     return fbstring();
   }
@@ -46,10 +48,12 @@ fbstring exception_wrapper::class_name() const {
 fbstring exception_wrapper::what() const {
   if (item_) {
     return exceptionStr(*item_);
-  } else if (eptr_) {
-    return estr_;
+  } else if (eptr_ && eobj_) {
+    return class_name() + ": " + eobj_->what();
+  } else if (eptr_ && etype_) {
+    return class_name();
   } else {
-    return fbstring();
+    return class_name();
   }
 }