Commit 7071acb
committed
fix: properly propagate errors in MetricsConfig validation
The previous code had a logic error when checking the result of
FindFieldByName(). It used:
if (!field.has_value() || !field.value().has_value())
This was incorrect because:
1. If FindFieldByName() returns an error (Result contains an error),
field.has_value() would be false, but the error was not propagated
2. field.value() returns std::optional<std::reference_wrapper<...>>,
so the second check was redundant and confusing
Fixed by using ICEBERG_ASSIGN_OR_RAISE to properly propagate any
errors from FindFieldByName(), then checking if the returned optional
contains a value. This matches the pattern used throughout the rest
of the codebase and ensures errors are properly handled.1 parent cf0fd37 commit 7071acb
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
| 39 | + | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
0 commit comments