diff --git a/src/jsMain/kotlin/ui/SheetsModal.kt b/src/jsMain/kotlin/ui/SheetsModal.kt
index fc274fd606f39a34f852f59866f6556b36f0420c..bb3d7f1e78295402b42c09ddfac935d478c3099b 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()