Skip to content

Commit 8a5f33d

Browse files
committed
Better comments in readme example
1 parent 2d8b4cd commit 8a5f33d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ jsonexpr::register_ast_function(
296296
const jsonexpr::function_registry& funcs) -> jsonexpr::ast_function_result {
297297
for (const jsonexpr::ast::node& arg : args) {
298298
// Evaluate the current argument.
299+
// This returns an 'expected<json,error>'.
299300
const auto evaluated = jsonexpr::evaluate(arg, vars, funcs);
300301
if (!evaluated.has_value()) {
301302
return jsonexpr::unexpected(evaluated.error());
@@ -308,9 +309,11 @@ jsonexpr::register_ast_function(
308309
}
309310
310311
// No match found, return an error.
311-
// NB: 'jsonexpr::error' contains both a message and a location (as the range of characters
312-
// in the expression string), to help the user locate the actual part of the expression that is causing a problem. If the location is not specified (as we did here), the location
313-
// will automatically be set to the whole function call.
312+
// NB: 'jsonexpr::error' contains both a message and a location (as the range of
313+
// characters in the expression string), to help the user locate the actual part
314+
// of the expression that is causing a problem. If the location is not specified
315+
// (as we did here), the location will automatically be set to the whole function
316+
// call.
314317
return jsonexpr::unexpected(jsonexpr::error{.message = "all arguments were null"});
315318
});
316319
```

0 commit comments

Comments
 (0)