Commit 6bafdff6 authored by Chad Parry's avatar Chad Parry Committed by facebook-github-bot-1

Simplify an exception handler

Summary: It looks like there is no reason to catch a `std::exception` and then `dynamic_cast` to a derived exception. We can just catch the derived exception directly.

whatcouldgowrong4

Reviewed By: yfeldblum

Differential Revision: D2677284

fb-gh-sync-id: 0149e4d4aecc96257376d410f592620205441f66
parent 4b750cf3
...@@ -214,8 +214,8 @@ class exception_wrapper { ...@@ -214,8 +214,8 @@ class exception_wrapper {
} else if (eptr_) { } else if (eptr_) {
try { try {
std::rethrow_exception(eptr_); std::rethrow_exception(eptr_);
} catch (std::exception& e) { } catch (typename std::decay<Ex>::type&) {
return dynamic_cast<const Ex*>(&e); return true;
} catch (...) { } catch (...) {
// fall through // fall through
} }
...@@ -323,11 +323,9 @@ private: ...@@ -323,11 +323,9 @@ private:
} else if (that->eptr_) { } else if (that->eptr_) {
try { try {
std::rethrow_exception(that->eptr_); std::rethrow_exception(that->eptr_);
} catch (std::exception& e) { } catch (Ex& e) {
if (auto ex = dynamic_cast<Ex*>(&e)) { f(e);
f(*ex); return true;
return true;
}
} catch (...) { } catch (...) {
// fall through // fall through
} }
......
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