summaryrefslogtreecommitdiff
path: root/client/ui_errcatch.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-06-06 20:48:20 +0200
committerlonkaars <loek@pipeframe.xyz>2022-06-06 20:48:20 +0200
commitfedc13d6564dcf110ba3b7faca3c34a28c7905cb (patch)
tree422a499d46e5e63618201054218300e04ed134fe /client/ui_errcatch.c
parentae8beb20a2a837824cfda4d748fbe07b26a161f0 (diff)
error logging working
Diffstat (limited to 'client/ui_errcatch.c')
-rw-r--r--client/ui_errcatch.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/client/ui_errcatch.c b/client/ui_errcatch.c
new file mode 100644
index 0000000..d2c32b2
--- /dev/null
+++ b/client/ui_errcatch.c
@@ -0,0 +1,27 @@
+#include <stdlib.h>
+
+#include "errcatch.h"
+#include "ui.h"
+
+char *w2_err_format(w2_s_error *error) {
+ char *ret_str = malloc(32);
+ sprintf(ret_str, "hai, 0x%02x", error->code);
+ return ret_str;
+}
+
+void w2_ui_tab_errcatch(bool first) {
+ g_w2_ui_pad_body_scroll = 5 - g_w2_ui_height;
+ unsigned int line = 0;
+ for (unsigned int x = 0; x < W2_ERRCATCH_LOG_SIZE; x++) {
+ unsigned int i = (x + g_w2_error_log_index) % W2_ERRCATCH_LOG_SIZE;
+ if (g_w2_error_log[i] == NULL) continue;
+
+ wmove(g_w2_ui_pad_body, line, 0);
+ char *err_str = w2_err_format(g_w2_error_log[i]);
+ waddstr(g_w2_ui_pad_body, err_str);
+ free(err_str);
+
+ line++;
+ }
+ g_w2_ui_pad_body_scroll += line;
+}