Skip to content

Conversation

@Ian-Flury
Copy link
Contributor

@Ian-Flury Ian-Flury commented Nov 21, 2025

  • Remove jsoncons::decode_* in favor of jsoncons::try_decode_*.
  • Addresses Issue 429

@gemini-code-assist
Copy link

Summary of Changes

Hello @Ian-Flury, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the CBOR and UBJSON decoding logic to utilize non-throwing versions of the jsoncons library functions. This change enhances the robustness and predictability of error handling by moving away from exception-based mechanisms towards a more explicit Result type pattern. The update also includes corresponding modifications to test cases to ensure the new error handling behavior is correctly validated.

Highlights

  • Non-throwing Decoding: The pull request replaces throwing jsoncons::decode_* functions with their non-throwing jsoncons::try_decode_* counterparts for CBOR and UBJSON parsing. This shifts error handling from try-catch blocks to checking the result.has_value() of the returned std::optional-like type.
  • Improved Error Messaging: Error messages for parsing failures are now generated directly from the jsoncons library's error messages, providing more specific details about the parsing issue.
  • Enhanced Test Coverage: New test cases have been added for both CBOR and UBJSON to specifically verify error messages for missing fields and type mismatches. Existing tests for decode errors have been updated to align with the new non-throwing error handling mechanism.
  • Documentation Update: A minor update was made to the tests/README.md file to correctly specify the language for a shell code block.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully replaces the exception-throwing decode_* functions with their non-throwing try_decode_* counterparts for both CBOR and UBJSON deserialization. This is a great improvement for error handling robustness. The corresponding tests have been updated to verify the new behavior, including checks for the new error messages and ensuring no exceptions are thrown. I've included a couple of minor suggestions to improve test code readability.

@Ian-Flury Ian-Flury force-pushed the exception_free_cbor_read branch from cae42c0 to d640686 Compare November 21, 2025 22:53
@liuzicheng1987 liuzicheng1987 merged commit 1bda2d0 into getml:main Nov 23, 2025
146 checks passed
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.

3 participants