Hey! I get this error: ```2021-03-27 19:53:03.556 ...
# announcements
h
Hey! I get this error:
Copy code
2021-03-27 19:53:03.556 [DefaultDispatcher-worker-1] ERROR Application - Unhandled exception caught for CoroutineName(call-handler)
kotlinx.coroutines.CoroutinesInternalError: Fatal exception in coroutines machinery for DispatchedContinuation[<http://Dispatchers.IO|Dispatchers.IO>, Continuation at io.ktor.server.engine.BaseApplicationResponse$respondWriteChannelContent$2$1.invokeSuspend(BaseApplicationResponse.kt:166)@4ed1ef02]. Please read KDoc to 'handleFatalException' method and report this incident to maintainers
	at kotlinx.coroutines.DispatchedTask.handleFatalException$kotlinx_coroutines_core(DispatchedTask.kt:144)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:115)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class kotlinx.coroutines.CompletedExceptionally
	at kotlinx.coroutines.CompletionStateKt.toState(CompletionState.kt:16)
	at kotlinx.coroutines.CompletionStateKt.toState$default(CompletionState.kt:13)
	at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:111)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	... 4 common frames omitted
When i run this function:
Copy code
val ApplicationCall.accountPrincipal: AccountPrincipal? get() = authentication.principal<AccountPrincipal>()
fun ApplicationCall.user(): Account? = transaction<Account?> {
    Account.find { (Accounts.id) eq accountPrincipal?.id }.firstOrNull()
}
I have tracked it down to where its used, here:
Copy code
get("/me") {
            val user = call.user;
            if(user == null)
                call.respond(HttpStatusCode.Unauthorized)
            else
                call.respond(HttpStatusCode.OK, mapOf(
                    "message" to "Account authenticated, data returned.",
                    "data" to user,
                ))
        }
this is the content negotiation i'm using:
Copy code
install(ContentNegotiation) {
        jackson {
            enable(SerializationFeature.INDENT_OUTPUT)
            dateFormat = DateFormat.getDateInstance()
        }
    }
I found the error, after switching to gson i got a better output/error and it was because i was just using the data strait from Exposed so i just made a custom data class to hold the data that needs to be send back!