From 8ec9711e58d242ca4eb982652dec2a96fe629bae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brage=20Skj=C3=B8nborg?= Date: Wed, 21 Jan 2026 19:09:58 +0100 Subject: [PATCH] Throwing instead of anonymous print --- src/main/kotlin/no/iktdev/eventi/ZDS.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/no/iktdev/eventi/ZDS.kt b/src/main/kotlin/no/iktdev/eventi/ZDS.kt index deb34ef..e4bad2f 100644 --- a/src/main/kotlin/no/iktdev/eventi/ZDS.kt +++ b/src/main/kotlin/no/iktdev/eventi/ZDS.kt @@ -24,8 +24,7 @@ object ZDS { fun Event.toPersisted(id: Long, persistedAt: LocalDateTime = LocalDateTime.now()): PersistedEvent? { val payloadJson = gson.toJson(this) val eventName = this::class.simpleName ?: run { - println("Missing class name for event: $this") - return null + throw IllegalStateException("Missing class name for event: $this") } return PersistedEvent( id = id, @@ -43,8 +42,7 @@ object ZDS { fun PersistedEvent.toEvent(): Event? { val clazz = EventTypeRegistry.resolve(event) ?: run { - println("Missing class name for event: $this") - return null + throw IllegalStateException("Missing class name for event: $this") } return gson.fromJson(data, clazz) } @@ -52,8 +50,7 @@ object ZDS { fun Task.toPersisted(id: Long, status: TaskStatus = TaskStatus.Pending, persistedAt: LocalDateTime = LocalDateTime.now()): PersistedTask? { val payloadJson = gson.toJson(this) val taskName = this::class.simpleName ?: run { - println("Missing class name for task: $this") - return null + throw IllegalStateException("Missing class name for task: $this") } return PersistedTask( id = id,