From b8c9b793d44426d01d62df11bc9185d26d0d0e40 Mon Sep 17 00:00:00 2001 From: Determinant Date: Mon, 25 Jun 2018 20:43:31 -0400 Subject: catch polymorphic exception by reference --- promise.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/promise.hpp b/promise.hpp index 9abd149..6f52583 100644 --- a/promise.hpp +++ b/promise.hpp @@ -486,7 +486,7 @@ namespace promise { return [f](pm_any_t v) mutable { try { f(any_cast(v)); - } catch (bad_any_cast e) { PROMISE_ERR_MISMATCH_TYPE; } + } catch (bad_any_cast &e) { PROMISE_ERR_MISMATCH_TYPE; } }; } @@ -524,7 +524,7 @@ namespace promise { try { return typename func_t::ret_type( f(any_cast(v))); - } catch (bad_any_cast e) { PROMISE_ERR_MISMATCH_TYPE; } + } catch (bad_any_cast &e) { PROMISE_ERR_MISMATCH_TYPE; } }; } -- cgit v1.2.3-70-g09d2