Skip to content

Commit

Permalink
Improve error messages to be more json-friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Sep 18, 2023
1 parent 2775949 commit a58f388
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/agent/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ global.r2pipe = {
}
};

const commandHandlers = {
onst commandHandlers = {
'?': [expr.evalNum, 'evaluate number'],
'?e': [echo, 'print message'],
'?E': [uiAlert, 'popup alert dialog on target app'],
Expand Down
5 changes: 4 additions & 1 deletion src/io_frida.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,10 @@ static bool __eternalizeScript(RIOFrida *rf, const char *fileName) {

static int on_compiler_diagnostics (void *user, GVariant *diagnostics) {
gchar *str = g_variant_print (diagnostics, TRUE);
str = r_str_replace (str, "int64", "int64:", true);
str = r_str_replace (str, "int64", "", true);
str = r_str_replace (str, "<", "", true);
str = r_str_replace (str, ">", "", true);
str = r_str_replace (str, "'", "\"", true);
char *json = r_print_json_indent (str, true, " ", NULL);
eprintf ("%s\n", json);
free (json);
Expand Down
5 changes: 4 additions & 1 deletion src/r2frida-compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@

static int on_compiler_diagnostics(void *user, GVariant *diagnostics) {
gchar *str = g_variant_print (diagnostics, TRUE);
str = r_str_replace (str, "int64", "int64:", true);
str = r_str_replace (str, "int64", "", true);
str = r_str_replace (str, "<", "", true);
str = r_str_replace (str, ">", "", true);
str = r_str_replace (str, "'", "\"", true);
char *json = r_print_json_indent (str, true, " ", NULL);
eprintf ("%s\n", json);
free (json);
Expand Down

0 comments on commit a58f388

Please sign in to comment.