Skip to content

Commit 372f61d

Browse files
committed
deps: update ata to 0.10.4 with structured type errors
1 parent affd42a commit 372f61d

4 files changed

Lines changed: 20 additions & 16 deletions

File tree

deps/ata/ata.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* auto-generated on 2026-04-18 10:54:35 +0100. Do not edit! */
2-
/* begin file src/ata.cpp */
31
#include "ata.h"
42

53
// mimalloc: faster new/delete for small allocations.
@@ -1362,8 +1360,10 @@ static void validate_node(const schema_node_ptr& node,
13621360
expected += json_type_name(static_cast<json_type>(b));
13631361
}
13641362
}
1363+
std::string actual = std::string(type_of_sv(value));
13651364
errors.push_back({error_code::type_mismatch, path,
1366-
"expected type " + expected + ", got " + std::string(type_of_sv(value))});
1365+
"expected type " + expected + ", got " + actual,
1366+
expected, actual});
13671367
ATA_CHECK_EARLY();
13681368
}
13691369
}
@@ -2807,4 +2807,3 @@ bool is_valid_buf(const schema_ref& schema, const uint8_t* data, size_t length)
28072807
}
28082808

28092809
} // namespace ata
2810-
/* end file src/ata.cpp */

deps/ata/ata.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* auto-generated on 2026-04-18 10:54:35 +0100. Do not edit! */
2-
/* begin file include/ata.h */
31
#pragma once
42

53
#include <cstdint>
@@ -10,16 +8,16 @@
108
#include <variant>
119
#include <vector>
1210

13-
#define ATA_VERSION "0.10.3"
11+
#define ATA_VERSION "0.10.4"
1412

1513
namespace ata {
1614

1715
inline constexpr uint32_t VERSION_MAJOR = 0;
1816
inline constexpr uint32_t VERSION_MINOR = 10;
19-
inline constexpr uint32_t VERSION_REVISION = 3;
17+
inline constexpr uint32_t VERSION_REVISION = 4;
2018

2119
inline constexpr std::string_view version() noexcept {
22-
return "0.10.3";
20+
return "0.10.4";
2321
}
2422

2523
enum class error_code : uint8_t {
@@ -57,6 +55,8 @@ struct validation_error {
5755
error_code code;
5856
std::string path;
5957
std::string message;
58+
std::string expected;
59+
std::string actual;
6060
};
6161

6262
struct validation_result {
@@ -109,4 +109,3 @@ bool is_valid_buf(const schema_ref& schema, const uint8_t* data, size_t length);
109109
inline constexpr size_t REQUIRED_PADDING = 64;
110110

111111
} // namespace ata
112-
/* end file include/ata.h */

src/node_config_file.cc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,16 @@ ParseResult ConfigReader::ParseConfig(const std::string_view& config_path) {
244244
if (!result.valid) {
245245
FPrintF(stderr, "Invalid configuration in %s:\n", config_path.data());
246246
for (const auto& err : result.errors) {
247-
FPrintF(stderr,
248-
" %s: %s\n",
249-
err.path.empty() ? "/" : err.path,
250-
err.message);
247+
const char* path = err.path.empty() ? "/" : err.path.c_str();
248+
if (err.code == ata::error_code::type_mismatch) {
249+
FPrintF(stderr,
250+
" %s should be %s, got %s\n",
251+
path,
252+
err.expected,
253+
err.actual);
254+
} else {
255+
FPrintF(stderr, " %s: %s\n", path, err.message);
256+
}
251257
}
252258
return ParseResult::InvalidContent;
253259
}

test/parallel/test-config-file.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ test('non object root', async () => {
291291
`--experimental-config-file=${fixtures.path('rc/non-object-root.json')}`,
292292
'-p', '"Hello, World!"',
293293
]);
294-
assert.match(result.stderr, /\/: expected type object, got array/);
294+
assert.match(result.stderr, /\/ should be object, got array/);
295295
assert.strictEqual(result.stdout, '');
296296
assert.strictEqual(result.code, 9);
297297
});
@@ -302,7 +302,7 @@ test('non object node options', async () => {
302302
`--experimental-config-file=${fixtures.path('rc/non-object-node-options.json')}`,
303303
'-p', '"Hello, World!"',
304304
]);
305-
assert.match(result.stderr, /\/nodeOptions: expected type object, got string/);
305+
assert.match(result.stderr, /\/nodeOptions should be object, got string/);
306306
assert.strictEqual(result.stdout, '');
307307
assert.strictEqual(result.code, 9);
308308
});

0 commit comments

Comments
 (0)