From 29a28f544df0e71c82de58dec0d5f9f110a46bfc Mon Sep 17 00:00:00 2001 From: Nicola Mometto Date: Tue, 27 Nov 2018 12:15:33 +0000 Subject: [PATCH] catch and print exceptions in Z3_mk_config instead of letting them bubble up the stack --- src/api/api_config_params.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/api/api_config_params.cpp b/src/api/api_config_params.cpp index 54b3c5795..60d5fa556 100644 --- a/src/api/api_config_params.cpp +++ b/src/api/api_config_params.cpp @@ -68,10 +68,17 @@ extern "C" { } Z3_config Z3_API Z3_mk_config(void) { - memory::initialize(UINT_MAX); - LOG_Z3_mk_config(); - Z3_config r = reinterpret_cast(alloc(context_params)); - RETURN_Z3(r); + try { + memory::initialize(UINT_MAX); + LOG_Z3_mk_config(); + Z3_config r = reinterpret_cast(alloc(context_params)); + RETURN_Z3(r); + } catch (z3_exception & ex) { + // The error handler is only available for contexts + // Just throw a warning. + warning_msg("%s", ex.msg()); + return nullptr; + } } void Z3_API Z3_del_config(Z3_config c) {