Skip to content

Commit

Permalink
chore: improve error message for fsevents failure
Browse files Browse the repository at this point in the history
Include the problematic event flags in the error message

Signed-off-by: Rudi Grinberg <[email protected]>

ps-id: 7ab84709-6af3-433e-b337-843610bd4119
  • Loading branch information
rgrinberg committed Oct 11, 2022
1 parent a757ad8 commit bfb9407
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/fsevents/fsevents_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,15 @@ CAMLprim value dune_fsevents_action(value v_flags) {
} else if (flags & kFSEventStreamEventFlagItemModified) {
v_action = Val_int(3);
} else {
caml_failwith("fsevents: unexpected event action");
char* msg;
int len = asprintf(&msg, "fsevents: unexpected event action %x", Int32_val(v_flags));
if (len < 0) {
caml_raise_out_of_memory();
}
CAMLlocal1(v_msg);
v_msg = caml_copy_string(msg);
free(msg);
caml_failwith_value(v_msg);
}

CAMLreturn(v_action);
Expand Down

0 comments on commit bfb9407

Please sign in to comment.