aboutsummaryrefslogtreecommitdiff
path: root/builtins/table.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-02-18 14:53:52 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-02-18 14:53:52 -0500
commit69d41fa068a08fcb468bd50babc43178faf0e114 (patch)
tree03febfb2e86eb81ada90a03648a8bfd5a18dc920 /builtins/table.h
parentf77a45095a76b99c9d470bc861bd69f5cb5b8742 (diff)
Add source information to runtime errors
Diffstat (limited to 'builtins/table.h')
-rw-r--r--builtins/table.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtins/table.h b/builtins/table.h
index 69d0aad9..d11a876d 100644
--- a/builtins/table.h
+++ b/builtins/table.h
@@ -18,10 +18,11 @@
$table.fallback = fb; \
$table.default_value = def; \
$table; })
-#define $Table_get(table_expr, key_t, val_t, key_expr, info_expr) ({ \
+#define $Table_get(table_expr, key_t, val_t, key_expr, info_expr, filename, start, end) ({ \
const table_t *$t = table_expr; key_t $k = key_expr; const TypeInfo* $info = info_expr; \
const val_t *$v = Table_get($t, &$k, $info); \
- if (__builtin_expect($v == NULL, 0)) fail("The key %r is not in this table\n", generic_as_str(&$k, USE_COLOR, $info->TableInfo.key)); \
+ if (__builtin_expect($v == NULL, 0)) \
+ fail_source(filename, start, end, "The key %r is not in this table\n", generic_as_str(&$k, USE_COLOR, $info->TableInfo.key)); \
*$v; })