diff options
Diffstat (limited to 'src/error.h')
| -rw-r--r-- | src/error.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/error.h b/src/error.h index 61bcce6..67de4aa 100644 --- a/src/error.h +++ b/src/error.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2025 Robin Haberkorn + * Copyright (C) 2012-2026 Robin Haberkorn * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,11 +42,13 @@ typedef enum { TECO_ERROR_SYNTAX, TECO_ERROR_MODIFIER, TECO_ERROR_ARGEXPECTED, + TECO_ERROR_LABEL, TECO_ERROR_CODEPOINT, TECO_ERROR_MOVE, TECO_ERROR_WORDS, TECO_ERROR_RANGE, TECO_ERROR_SUBPATTERN, + TECO_ERROR_INVALIDBUF, TECO_ERROR_INVALIDQREG, TECO_ERROR_QREGOPUNSUPPORTED, TECO_ERROR_QREGCONTAINSNULL, @@ -91,10 +93,18 @@ teco_error_argexpected_set(GError **error, const gchar *cmd) } static inline void +teco_error_label_set(GError **error, const gchar *name, gsize len) +{ + g_autofree gchar *label_printable = teco_string_echo(name, len); + g_set_error(error, TECO_ERROR, TECO_ERROR_LABEL, + "Label \"%s\" not found", label_printable); +} + +static inline void teco_error_codepoint_set(GError **error, const gchar *cmd) { g_set_error(error, TECO_ERROR, TECO_ERROR_CODEPOINT, - "Invalid Unicode codepoint for <%s>", cmd); + "Invalid codepoint for <%s>", cmd); } static inline void @@ -126,6 +136,13 @@ teco_error_subpattern_set(GError **error, const gchar *cmd) } static inline void +teco_error_invalidbuf_set(GError **error, teco_int_t id) +{ + g_set_error(error, TECO_ERROR, TECO_ERROR_INVALIDBUF, + "Invalid buffer id %" TECO_INT_FORMAT, id); +} + +static inline void teco_error_invalidqreg_set(GError **error, const gchar *name, gsize len, gboolean local) { g_autofree gchar *name_printable = teco_string_echo(name, len); |
