Skip to content
Snippets Groups Projects
Commit ca97eb38 authored by Tóth Miklós Tibor's avatar Tóth Miklós Tibor :shrug:
Browse files

Error handling

parent 9eaffd5c
Branches
Tags
No related merge requests found
Pipeline #31316 passed
......@@ -4,6 +4,7 @@ import datasources.GSheet
import androidx.compose.runtime.*
import gapi.*
import kotlinx.browser.document
import kotlinx.browser.window
import kotlinx.coroutines.launch
import org.jetbrains.compose.web.attributes.InputType
import org.jetbrains.compose.web.attributes.disabled
......@@ -106,9 +107,18 @@ private object SheetsModal: ModalType {
classes("uk-button", "uk-button-primary")
onClick {
scope.launch {
try {
sheet = GSheet.new(sheetUrl, sheetNum - 1)
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()
}
}
}
(document.getElementById(closeId) as HTMLElement).click()
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment