aboutsummaryrefslogtreecommitdiff
path: root/src/api/helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/helpers.c')
-rw-r--r--src/api/helpers.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/api/helpers.c b/src/api/helpers.c
index 425da998bc..9f41e55d39 100644
--- a/src/api/helpers.c
+++ b/src/api/helpers.c
@@ -21,15 +21,12 @@ bool try_end(Error *err)
did_emsg = false;
if (got_int) {
- const char msg[] = "Keyboard interrupt";
-
if (did_throw) {
// If we got an interrupt, discard the current exception
discard_current_exception();
}
- strncpy(err->msg, msg, sizeof(err->msg));
- err->set = true;
+ set_api_error("Keyboard interrupt", err);
got_int = false;
} else if (msg_list != NULL && *msg_list != NULL) {
int should_free;
@@ -45,8 +42,7 @@ bool try_end(Error *err)
free(msg);
}
} else if (did_throw) {
- strncpy(err->msg, (char *)current_exception->value, sizeof(err->msg));
- err->set = true;
+ set_api_error((char *)current_exception->value, err);
}
return err->set;