Skip to content

Commit

Permalink
flux-kvs: improve eventlog error messages
Browse files Browse the repository at this point in the history
Problem: When an improperly formatted eventlog is input into eventlog
commands, a non-useful error message is output.

Output a better error message.
  • Loading branch information
chu11 committed Dec 20, 2024
1 parent e10d676 commit 1c6c0fb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/cmd/flux-kvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2019,8 +2019,11 @@ void eventlog_get_continuation (flux_future_t *f, void *arg)
if (flux_kvs_lookup_get (f, &s) < 0)
log_err_exit ("flux_kvs_lookup_get");

if (!(a = eventlog_decode (s)))
if (!(a = eventlog_decode (s))) {
if (errno == EINVAL)
log_msg_exit ("cannot decode improperly formatted eventlog");
log_err_exit ("eventlog_decode");
}

json_array_foreach (a, index, value) {
if (optparse_hasopt (ctx->p, "watch")) {
Expand Down Expand Up @@ -2135,8 +2138,11 @@ void eventlog_wait_event_continuation (flux_future_t *f, void *arg)
log_err_exit ("flux_kvs_lookup_get");
}

if (!(a = eventlog_decode (s)))
if (!(a = eventlog_decode (s))) {
if (errno == EINVAL)
log_msg_exit ("cannot decode improperly formatted eventlog");
log_err_exit ("eventlog_decode");
}

json_array_foreach (a, index, value) {
const char *name;
Expand Down

0 comments on commit 1c6c0fb

Please sign in to comment.