Skip to content

Conversation

@qwwdfsad
Copy link
Member

  • Note that guide tests are not yet fixed

Fixes #2066

* Note that guide tests are not yet fixed

Fixes #2066
@qwwdfsad qwwdfsad requested a review from sandwwraith October 19, 2022 10:55
@qwwdfsad
Copy link
Member Author

I'll fix guide tests if you are ok with the wording


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)'"
Copy link
Member

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.

Copy link
Member Author

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

@qwwdfsad qwwdfsad merged commit 3000afc into dev Nov 15, 2022
@qwwdfsad qwwdfsad deleted the better-exception-message branch November 15, 2022 11:32
fred01 pushed a commit to fred01/kotlinx.serialization that referenced this pull request Nov 24, 2022
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.

4 participants