Include class name in non-parcelable args error message#733
Merged
elihart merged 1 commit intoairbnb:mainfrom Jan 28, 2026
Merged
Include class name in non-parcelable args error message#733elihart merged 1 commit intoairbnb:mainfrom
elihart merged 1 commit intoairbnb:mainfrom
Conversation
When args passed to a ViewModel are neither Parcelable nor Serializable, the error message now includes the class name to help developers quickly identify which class needs to be fixed. Before: "Args must be parcelable or serializable" After: "Args must be parcelable or serializable. Class com.example.MyArgs is neither." This follows the same pattern as commit e920c4b which improved error messages in PersistState.kt. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
b092056 to
987d4c5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When args passed to a ViewModel are neither
ParcelablenorSerializable, the error message now includes the class name to help developers quickly identify which class needs to be fixed.Before:
After:
Motivation
This change addresses a debugging pain point where the existing error message doesn't indicate which class is causing the exception. When an app has multiple ViewModels with different args types, identifying the problematic class requires manual investigation.
This follows the same pattern as commit e920c4b which improved error messages in
PersistState.ktfor similar serialization issues.Changes
${args::class.java.name}testNonParcelableArgsErrorContainsClassNameto verify the error message contains the class nameTest plan
./gradlew :mvrx:test)