From c675de5ac7eeafb4a8b3f841d673e5688212250a Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Sun, 10 Nov 2024 17:43:09 +0100 Subject: [PATCH] SWIG: Fix uncaught exception Closes #379 --- NEWS.md | 3 ++- src/swig/nlopt-exceptions.i | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index cb865bfd..a51fd810 100644 --- a/NEWS.md +++ b/NEWS.md @@ -16,7 +16,7 @@ * Fixed STOGO not registering new optimum ([#504]) -* Various minor bugfixes ([#570], [#563]) +* Various minor bugfixes ([#570], [#563], [#379]) ## NLopt 2.8 @@ -507,6 +507,7 @@ [#361]: https://github.com/stevengj/nlopt/issues/361 [#365]: https://github.com/stevengj/nlopt/issues/365 [#368]: https://github.com/stevengj/nlopt/issues/368 +[#379]: https://github.com/stevengj/nlopt/issues/379 [#409]: https://github.com/stevengj/nlopt/issues/409 [#420]: https://github.com/stevengj/nlopt/issues/420 [#445]: https://github.com/stevengj/nlopt/issues/445 diff --git a/src/swig/nlopt-exceptions.i b/src/swig/nlopt-exceptions.i index 36ac0999..26dfcfc7 100644 --- a/src/swig/nlopt-exceptions.i +++ b/src/swig/nlopt-exceptions.i @@ -6,6 +6,7 @@ %catches(std::bad_alloc) nlopt::opt::opt(); %catches(std::bad_alloc) nlopt::opt::opt(algorithm a, unsigned n); +%catches(std::bad_alloc,std::invalid_argument) nlopt::opt::opt(const char *algo_str, unsigned n); %catches(std::bad_alloc) nlopt::opt::opt(const opt& f); %catches(std::bad_alloc) nlopt::opt::operator=(opt const& f);