You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by "userzhy (via GitHub)" <gi...@apache.org> on 2025/12/20 08:09:36 UTC

[PR] fix(rust): output original registered ID in type mismatch error log [fory]

userzhy opened a new pull request, #3067:
URL: https://github.com/apache/fory/pull/3067

   ## Why?
   
   Current Fory Rust's error messages display the combined type ID (after left-shifting) which is confusing for users. For example:
   
   ```text
   FORY_PANIC_ON_ERROR: Type mismatch: type_a = 787, type_b = 6
   ```
   
   Here `787` is the internal combined type ID `(3 << 8) + 19`, but users registered using `ID=3`. This makes debugging difficult as users cannot easily correlate the error with their registration code.
   
   ## What does this PR do?
   
   This PR improves the type mismatch error message to show the original registered ID along with the internal type name:
   
   ```text
   Type mismatch: local registered_id=3(EXT) vs remote INT64
   ```
   
   **Changes:**
   - Added `format_type_id()` function in `types.rs` to parse combined type IDs and format them into human-readable strings.
   - Modified `TypeMismatch` error variant to use the formatted string message.
   - Added test case to verify the new error message format.
   
   ## Related issues
   
   Closes #3054
   
   ## Does this PR introduce any user-facing change?
   
   - [ ] Does this PR introduce any public API change?
   - [ ] Does this PR introduce any binary protocol compatibility change?
   
   The error message format is changed but it only affects the display of error messages, not the API or binary protocol.
   
   ## Benchmark
   
   Not applicable. This change only affects error message formatting in the error path, which has no impact on serialization/deserialization performance.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [PR] fix(rust): output original registered ID in type mismatch error log [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang merged PR #3067:
URL: https://github.com/apache/fory/pull/3067


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org