aboutsummaryrefslogtreecommitdiff
path: root/error/include/error.h
diff options
context:
space:
mode:
Diffstat (limited to 'error/include/error.h')
-rw-r--r--error/include/error.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/error/include/error.h b/error/include/error.h
new file mode 100644
index 0000000..92c06ff
--- /dev/null
+++ b/error/include/error.h
@@ -0,0 +1,22 @@
1#pragma once
2
3#include <cstring.h>
4#include <stdio.h>
5
6/// Get the last error.
7const char* get_error(void);
8
9extern xlstring gfx_error;
10
11/// Set the last error.
12#define set_error(...) \
13 gfx_error.length = snprintf(gfx_error.str, xlstring_size, __VA_ARGS__)
14
15/// Prepend an error to the last error.
16#define prepend_error(...) \
17 { \
18 xlstring head; \
19 head.length = snprintf(head.str, xlstring_size, __VA_ARGS__); \
20 xlstring_append(&head, xlstring_make(": ")); \
21 gfx_error = xlstring_concat(head, gfx_error); \
22 }