@@ -774,7 +774,7 @@ namespace view {
774774
775775 // Validates and passes over one complete item, returning its encoded
776776 // bytes unparsed. Costs and failure reporting match read_item.
777- expected<span<const uint8_t >, scan_error> skip_item (scan_context& context);
777+ expected<span<const uint8_t >, scan_error> skip_item (scan_context& context) noexcept ;
778778
779779 // Advances past `count` bytes of already-measured content, such as a
780780 // definite string payload after its head. False, leaving the position
@@ -1574,18 +1574,26 @@ namespace view {
15741574 return scanned.value ().first ;
15751575 }
15761576
1577- inline expected<span<const uint8_t >, scan_error> wire_cursor::skip_item (scan_context& context)
1577+ inline expected<span<const uint8_t >, scan_error> wire_cursor::skip_item (scan_context& context) noexcept
15781578 {
15791579 const uint8_t * const start = current_;
15801580 std::error_code ec;
1581- const bool ok = detail_view::skip_item (current_, end_, context.max_nesting_depth (),
1582- detail_view::scan_access::workspace (context), ec);
1583- if (!ok)
1581+ JSONCONS_TRY
1582+ {
1583+ const bool ok = detail_view::skip_item (current_, end_, context.max_nesting_depth (),
1584+ detail_view::scan_access::workspace (context), ec);
1585+ if (!ok)
1586+ {
1587+ return expected<span<const uint8_t >, scan_error>(unexpect,
1588+ scan_error{detail_view::to_cbor_errc (ec), position ()});
1589+ }
1590+ return span<const uint8_t >(start, static_cast <std::size_t >(current_ - start));
1591+ }
1592+ JSONCONS_CATCH (...)
15841593 {
15851594 return expected<span<const uint8_t >, scan_error>(unexpect,
1586- scan_error{detail_view::to_cbor_errc (ec) , position ()});
1595+ scan_error{cbor_errc::source_error , position ()});
15871596 }
1588- return span<const uint8_t >(start, static_cast <std::size_t >(current_ - start));
15891597 }
15901598
15911599
0 commit comments