Skip to content

Commit

Permalink
[wasm] Use g_printerr to emit errors in mini-wasm.c, so they show u…
Browse files Browse the repository at this point in the history
…p wit… (#49838)

* [wasm] Use g_error to emit errors in mini-wasm.c, so they show up with traces in js console

* address review feedback

vargaz: printf in JIT code is mapped to the platform logging operation, so this one can stay as it is.

* Use g_printerr instead of g_error, as suggested by feedback
  • Loading branch information
radical authored Mar 20, 2021
1 parent 08d282c commit 026b71d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/mono/mono/mini/mini-wasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,13 +567,13 @@ mono_set_timeout_exec (int id)
//YES we swallow exceptions cuz there's nothing much we can do from here.
//FIXME Maybe call the unhandled exception function?
if (!is_ok (error)) {
printf ("timeout callback failed due to %s\n", mono_error_get_message (error));
g_printerr ("timeout callback failed due to %s\n", mono_error_get_message (error));
mono_error_cleanup (error);
}

if (exc) {
char *type_name = mono_type_get_full_name (mono_object_class (exc));
printf ("timeout callback threw a %s\n", type_name);
g_printerr ("timeout callback threw a %s\n", type_name);
g_free (type_name);
}
}
Expand Down Expand Up @@ -605,13 +605,13 @@ tp_cb (void)
mono_runtime_try_invoke (method, NULL, NULL, &exc, error);

if (!is_ok (error)) {
printf ("ThreadPool Callback failed due to error: %s\n", mono_error_get_message (error));
g_printerr ("ThreadPool Callback failed due to error: %s\n", mono_error_get_message (error));
mono_error_cleanup (error);
}

if (exc) {
char *type_name = mono_type_get_full_name (mono_object_class (exc));
printf ("ThreadPool Callback threw an unhandled exception of type %s\n", type_name);
g_printerr ("ThreadPool Callback threw an unhandled exception of type %s\n", type_name);
g_free (type_name);
}
}
Expand Down

0 comments on commit 026b71d

Please sign in to comment.