Add an API to retrieve the last error message.

[INTERPRETER]
* NEW: Add an API to retrieve the last error message.
This commit is contained in:
Benoît Minisini 2022-07-23 15:40:08 +02:00
parent 99f5df2d43
commit d053ced083
5 changed files with 14 additions and 3 deletions

View File

@ -118,6 +118,7 @@ const void *const GAMBAS_Api[] =
(void *)GB_Error,
(void *)GB_HasError,
(void *)GB_GetErrorMessage,
(void *)ERROR_propagate,
(void *)GB_Deprecated,
(void *)GB_OnErrorBegin,
@ -1285,11 +1286,19 @@ void GB_Error(const char *error, ...)
EXEC_set_native_error(TRUE);
}
bool GB_HasError()
{
return EXEC_has_native_error();
}
char *GB_GetErrorMessage()
{
return ERROR_last.msg;
}
void GB_Deprecated(const char *msg, const char *func, const char *repl)
{
if (EXEC_debug)

View File

@ -59,6 +59,7 @@ bool GB_UnSerialize(const char *path, GB_VALUE *value);
void GB_Error(const char *msg, ...);
bool GB_HasError(void);
char *GB_GetErrorMessage(void);
void GB_Deprecated(const char *msg, const char *func, const char *repl);
void GB_OnErrorBegin(GB_ERROR_HANDLER *handler);
void GB_OnErrorEnd(GB_ERROR_HANDLER *handler);

View File

@ -1,4 +1,4 @@
[Component]
Key=gb.jit
Version=3.16.90
Version=3.17.90
Authors=Benoît Minisini

View File

@ -2,7 +2,7 @@
Title=Gambas JIT compiler support
Startup=Main
Icon=.hidden/icon.png
Version=3.16.90
Version=3.17.90
VersionFile=1
Authors="Benoît Minisini"
TabSize=2

View File

@ -1015,7 +1015,8 @@ typedef
char *(*GetUnknown)(void);
void (*Error)(const char *, ...);
bool (*HasError)();
bool (*HasError)(void);
char *(*GetErrorMessage)(void);
void (*Propagate)(void);
void (*Deprecated)(const char *, const char *, const char *);
void (*OnErrorBegin)(GB_ERROR_HANDLER *);