⚠️ Potential issue | 🟡 Minor
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find all callers of get_value()/move_value() to confirm they all pre-check is_error()/is_success().
rg -nP -C3 '\b(get_value|move_value)\s*\(\s*\)' --type=cpp --type=c
Repository: vtz/opensomeip
Length of output: 32716
In-tree usage is correctly guarded; but confirm public API contract for external consumers.
All verified in-tree calls to get_value() and move_value() are properly guarded with is_error() checks, confirming they cannot trigger std::abort() in normal operation. However, the switch from throwing std::bad_optional_access to calling std::abort() is a breaking change if this class is exposed as public API — downstream consumers may have relied on exception handling for recovery. In safety-critical contexts (SOME/IP stack), consider whether unconditional std::abort() is the right choice versus:
- Preserving exception behavior (maintaining API compatibility)
- Debug-only
assert (catches errors early during development)
std::terminate() (clearer intent than abort for fatal errors)
Confirm this class's API contract and whether public consumers exist before finalizing this change.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@include/serialization/serializer.h` around lines 80 - 95, The change from
throwing std::bad_optional_access to calling std::abort() in get_value() and
move_value() is a breaking API change for external consumers; revert to the
previous exception behavior (throw std::bad_optional_access when value_ is
empty) or, if abort-like behavior is desired only in debug builds, replace the
unconditional std::abort() with a debug-only assertion (e.g.,
assert(value_.has_value())) and throw std::bad_optional_access in release
builds; update the public API contract/comments on get_value() and move_value()
to document the chosen behavior so downstream users know whether they must
handle exceptions or if the call is fatal.
Originally posted by @coderabbitai[bot] in #234 (comment)
🧩 Analysis chain
🏁 Script executed:
Repository: vtz/opensomeip
Length of output: 32716
In-tree usage is correctly guarded; but confirm public API contract for external consumers.
All verified in-tree calls to
get_value()andmove_value()are properly guarded withis_error()checks, confirming they cannot triggerstd::abort()in normal operation. However, the switch from throwingstd::bad_optional_accessto callingstd::abort()is a breaking change if this class is exposed as public API — downstream consumers may have relied on exception handling for recovery. In safety-critical contexts (SOME/IP stack), consider whether unconditionalstd::abort()is the right choice versus:assert(catches errors early during development)std::terminate()(clearer intent than abort for fatal errors)Confirm this class's API contract and whether public consumers exist before finalizing this change.
🤖 Prompt for AI Agents
Originally posted by @coderabbitai[bot] in #234 (comment)