mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Add command exec error handling
This commit is contained in:
parent
925cd488c1
commit
40eee1caab
@ -378,6 +378,7 @@ void win_clear(ProfWin *window);
|
||||
char* win_get_tab_identifier(ProfWin *window);
|
||||
char* win_to_string(ProfWin *window);
|
||||
void win_command_list_error(ProfWin *window, const char *const error);
|
||||
void win_command_exec_error(ProfWin *window, const char *const command, const char *const error, ...);
|
||||
void win_handle_command_list(ProfWin *window, GSList *cmds);
|
||||
void win_handle_command_exec_result_note(ProfWin *window, const char *const type, const char *const value);
|
||||
|
||||
|
@ -1733,6 +1733,21 @@ win_command_list_error(ProfWin *window, const char *const error)
|
||||
win_println(window, THEME_ERROR, '!', "Error retrieving command list: %s", error);
|
||||
}
|
||||
|
||||
void
|
||||
win_command_exec_error(ProfWin *window, const char *const command, const char *const error, ...)
|
||||
{
|
||||
assert(window != NULL);
|
||||
va_list arg;
|
||||
va_start(arg, error);
|
||||
GString *msg = g_string_new(NULL);
|
||||
g_string_vprintf(msg, error, arg);
|
||||
|
||||
win_println(window, THEME_ERROR, '!', "Error executing command %s: %s", command, msg);
|
||||
|
||||
g_string_free(msg, TRUE);
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
void
|
||||
win_handle_command_list(ProfWin *window, GSList *cmds)
|
||||
{
|
||||
|
@ -1112,7 +1112,7 @@ _command_exec_response_handler(xmpp_stanza_t *const stanza, void *const userdata
|
||||
log_debug("Error executing command %s for %s: %s", command, from, error_message);
|
||||
ProfWin *win = wins_get_by_string(from);
|
||||
if (win) {
|
||||
win_command_list_error(win, error_message);
|
||||
win_command_exec_error(win, command, error_message);
|
||||
}
|
||||
free(error_message);
|
||||
free(from);
|
||||
|
Loading…
Reference in New Issue
Block a user