Skip to content

Test for JSON & CBOR encoding error handling #432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 14, 2025

Conversation

bryceschober
Copy link
Contributor

This PR is a working illustration of the problem reported in #429.

The current implementation using jsoncons::cbor::decode_cbor() always throws when there is a fundamental CBOR decoding error, as opposed to a mere structure reflection mismatch.

@liuzicheng1987
Copy link
Contributor

@bryceschober You refer to the try-except logic as a "hacky crap workaround". In my view, it is totally fine, not hacky at all. It is possible that jsoncons leaves us no other choice anyway.

@bryceschober
Copy link
Contributor Author

@bryceschober You refer to the try-except logic as a "hacky crap workaround". In my view, it is totally fine, not hacky at all. It is possible that jsoncons leaves us no other choice anyway.

I have rebuilt this PR to reflect acceptance of the reality of the current universe. 😜

The current implementations using the `jsoncons` `decode_*()` functions
always throw when there is a fundamental decoding error, as opposed to a
mere type reflection mismatch.
@bryceschober bryceschober force-pushed the cbor-decode-exceptions branch from 90a1f96 to 3eb2c6e Compare May 12, 2025 22:57
@liuzicheng1987 liuzicheng1987 merged commit b6446a8 into getml:main May 14, 2025
11 checks passed
@liuzicheng1987
Copy link
Contributor

@bryceschober merged. Thank you for your contribution!

@bryceschober bryceschober deleted the cbor-decode-exceptions branch May 14, 2025 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants