Improve error message truncation with closing delimiters (#3478)
Truncated strings now show closing delimiters: `..."` for strings, `...]` for arrays, and `...}` for objects, making error messages clearer.
This commit is contained in:
1 parent
a2741ee0a8
commit
22361cfb87
9 files changed
+88
-72
No files matched your search
+1
-1
@@ -164,7 +164,7 @@ int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, block* answer, int* errors,
|
||||
* object key. */
|
||||
static jv check_object_key(block k) {
|
||||
if (block_is_const(k) && block_const_kind(k) != JV_KIND_STRING) {
|
||||
char errbuf[15];
|
||||
char errbuf[30];
|
||||
return jv_string_fmt("Cannot use %s (%s) as object key",
|
||||
jv_kind_name(block_const_kind(k)),
|
||||
jv_dump_string_trunc(block_const(k), errbuf, sizeof(errbuf)));
|
||||
|
||||
Reference in new issue
Block a user