From 1616827a52e4a40bb7e62ba8a3ee33e65251cc59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20T=C3=B3th?= <tothmiklostibor@gmail.com> Date: Fri, 17 Jun 2022 17:47:31 +0200 Subject: [PATCH] Error memes --- src/jsMain/kotlin/ui/SheetsModal.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/jsMain/kotlin/ui/SheetsModal.kt b/src/jsMain/kotlin/ui/SheetsModal.kt index fc274fd..bb3d7f1 100644 --- a/src/jsMain/kotlin/ui/SheetsModal.kt +++ b/src/jsMain/kotlin/ui/SheetsModal.kt @@ -112,12 +112,15 @@ private object SheetsModal: ModalType { sheet?.process { setState(ImportInProgress(it)) } setState(Ready) } catch (e: dynamic) { - val str = "$e" + if(e is Throwable) "\n" + e.stackTraceToString() else "" - window.alert(str) - if (e is Throwable) { - console.log(e) - e.printStackTrace() + val thr = e as? Exception ?: e as? Throwable + console.log(e) + var str = "$e" + if (thr != null) { + thr.printStackTrace() + str += "\n" + str += thr.stackTraceToString() } + window.alert(str) } } (document.getElementById(closeId) as HTMLElement).click() -- GitLab