Skip to content

Commit

Permalink
handling singular error from libraries (#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes14 committed Oct 28, 2023
1 parent 0374f71 commit 6304657
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion deps/src/caller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions deps/src/caller.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
#include "includes.h"

void singular_define_caller(jlcxx::Module &);
extern std::vector<std::string> singular_error_log;

#endif
2 changes: 1 addition & 1 deletion deps/src/singular.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
static std::string singular_return;
static std::string singular_error;
static std::string singular_warning;
static std::vector<std::string> singular_error_log;
std::vector<std::string> singular_error_log;

// Internal singular interpreter variable
extern int inerror;
Expand Down

0 comments on commit 6304657

Please sign in to comment.