From 6304657a72cace556fc8dfb0577a91f92b491e63 Mon Sep 17 00:00:00 2001 From: Hans Schoenemann Date: Sat, 28 Oct 2023 17:11:41 +0200 Subject: [PATCH] handling singular error from libraries (#721) --- deps/src/caller.cpp | 10 +++++++++- deps/src/caller.h | 1 + deps/src/singular.cpp | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/deps/src/caller.cpp b/deps/src/caller.cpp index c08177be3..1cd756cf4 100644 --- a/deps/src/caller.cpp +++ b/deps/src/caller.cpp @@ -304,7 +304,15 @@ jl_value_t * call_singular_library_procedure(std::string s, { inerror = 0; errorreported = 0; - jl_error("Could not call function"); + if (err==2) jl_error("Could not call function"); + else if(err==1) + { + std::stringstream ss; + for (auto & si : singular_error_log) + ss << si << std::endl; + singular_error_log.clear(); + jl_error(ss.str().c_str()); + } } if (ret->next != NULL) { diff --git a/deps/src/caller.h b/deps/src/caller.h index bf49c67da..7728a9f1a 100644 --- a/deps/src/caller.h +++ b/deps/src/caller.h @@ -4,5 +4,6 @@ #include "includes.h" void singular_define_caller(jlcxx::Module &); +extern std::vector singular_error_log; #endif diff --git a/deps/src/singular.cpp b/deps/src/singular.cpp index ed44f460b..29a07da50 100644 --- a/deps/src/singular.cpp +++ b/deps/src/singular.cpp @@ -9,7 +9,7 @@ static std::string singular_return; static std::string singular_error; static std::string singular_warning; -static std::vector singular_error_log; +std::vector singular_error_log; // Internal singular interpreter variable extern int inerror;