forked from ground/cground
Update error handling inside extlibs
This commit is contained in:
@@ -90,7 +90,7 @@ bool isMainScopeGlobal = true;
|
||||
printGroundInstruction(error->where);
|
||||
printf("\n");
|
||||
}
|
||||
if (error->line > -1) {
|
||||
if (error->hasLine) {
|
||||
printf(" ErrorLine: %zu\n", error->line + 1);
|
||||
}
|
||||
exit(1);
|
||||
@@ -1762,6 +1762,9 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop
|
||||
if (function->nativeFn) {
|
||||
GroundValue returnValue = function->nativeFn(scope, argsList);
|
||||
if (returnValue.type == ERROR) {
|
||||
returnValue.data.errorVal.line = currentInstruction;
|
||||
returnValue.data.errorVal.hasLine = true;
|
||||
returnValue.data.errorVal.where = in;
|
||||
if (scope->isMainScope) {
|
||||
throwError(&returnValue.data.errorVal);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user