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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to