-
Notifications
You must be signed in to change notification settings - Fork 665
Consolidate exception message and improve it #2068
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
Conversation
* Note that guide tests are not yet fixed Fixes #2066
|
I'll fix guide tests if you are ok with the wording |
core/commonMain/src/kotlinx/serialization/internal/Platform.common.kt
Outdated
Show resolved
Hide resolved
|
|
||
| internal fun KClass<*>.notRegisteredMessage(): String = "Serializer for class '${simpleName}' is not found.\n" + | ||
| "Please ensure that class is marked as '@Serializable' and that serialization plugin is applied.\n" + | ||
| "It is also possible to specify serializer explicitly with '${simpleName}.serializer(typeArgs)'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should also mention external non-default serializers here (they can only be used explicitly).
Also, the same message would be shown if use someModule.serializer() and no serializer is registered in the module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reverted even the last line -- it looks alien and requires an additional explanation for cases like:
It is also possible to specify serializer explicitly with 'Any.serializer(typeArgs)'. Also, it doesn't seem that it can be reasonably explained for a newcomer why it is possible to specify serializer explicitly when it's not found (???).
The same story with modules -- all the phrasing and corner cases I've found are not worth it
core/commonMain/src/kotlinx/serialization/internal/Platform.common.kt
Outdated
Show resolved
Hide resolved
…mmon.kt Co-authored-by: Leonid Startsev <[email protected]>
Fixes #2066