Kotlin Serialization

Hi guys do you know why do I get an error from my kotlin code?
@Serializable(with = DefinitionExceptionSerializer::class)
sealed class DefinitionException(
val id: String,
override val message: String
): Exception(message)

@Serializable
class InvitationAlreadySentException(val expire: Instant): DefinitionException(
"${Invitation.ENTITY_NAME}-already-sent",
"Invite already pending, you will be able to try again in ${expire.epochSecond - Instant.now().epochSecond}"
)
@Serializable(with = DefinitionExceptionSerializer::class)
sealed class DefinitionException(
val id: String,
override val message: String
): Exception(message)

@Serializable
class InvitationAlreadySentException(val expire: Instant): DefinitionException(
"${Invitation.ENTITY_NAME}-already-sent",
"Invite already pending, you will be able to try again in ${expire.epochSecond - Instant.now().epochSecond}"
)
I get this error from the class InvitationAlreadySentException Impossible to make this class serializable because its parent is not serializable and does not have exactly one constructor without parameters
2 Replies
JavaBot
JavaBot15mo ago
This post has been reserved for your question.
Hey @Pseudow! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
JavaBot
JavaBot15mo ago
Post Closed
This post has been closed by <@1123703840739442698>.

Did you find this page helpful?