mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2025-12-10 23:02:06 +01:00
Fix/electron launch error not logged (#895)
* Log "Browser::openInBrowser" errors The error was never written to the log file. It was only visible in the console * Remove "printStackTrace" usage with logs
This commit is contained in:
@@ -218,7 +218,7 @@ fun applicationSetup() {
|
|||||||
}
|
}
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
// cover both java.lang.Exception and java.lang.Error
|
// cover both java.lang.Exception and java.lang.Error
|
||||||
e.printStackTrace()
|
logger.error(e) { "Failed to create/remove SystemTray due to" }
|
||||||
}
|
}
|
||||||
}, ignoreInitialValue = false)
|
}, ignoreInitialValue = false)
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,11 @@ package suwayomi.tachidesk.server.util
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import dorkbox.desktop.Desktop
|
import dorkbox.desktop.Desktop
|
||||||
|
import mu.KotlinLogging
|
||||||
import suwayomi.tachidesk.server.serverConfig
|
import suwayomi.tachidesk.server.serverConfig
|
||||||
|
|
||||||
object Browser {
|
object Browser {
|
||||||
|
private val logger = KotlinLogging.logger { }
|
||||||
private val electronInstances = mutableListOf<Any>()
|
private val electronInstances = mutableListOf<Any>()
|
||||||
|
|
||||||
private fun getAppBaseUrl(): String {
|
private fun getAppBaseUrl(): String {
|
||||||
@@ -28,14 +30,14 @@ object Browser {
|
|||||||
electronInstances.add(ProcessBuilder(electronPath, appBaseUrl).start())
|
electronInstances.add(ProcessBuilder(electronPath, appBaseUrl).start())
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
// cover both java.lang.Exception and java.lang.Error
|
// cover both java.lang.Exception and java.lang.Error
|
||||||
e.printStackTrace()
|
logger.error(e) { "openInBrowser: failed to launch electron due to" }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
Desktop.browseURL(appBaseUrl)
|
Desktop.browseURL(appBaseUrl)
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
// cover both java.lang.Exception and java.lang.Error
|
// cover both java.lang.Exception and java.lang.Error
|
||||||
e.printStackTrace()
|
logger.error(e) { "openInBrowser: failed to launch browser due to" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ package suwayomi.tachidesk.server.util
|
|||||||
import dorkbox.systemTray.MenuItem
|
import dorkbox.systemTray.MenuItem
|
||||||
import dorkbox.systemTray.SystemTray
|
import dorkbox.systemTray.SystemTray
|
||||||
import dorkbox.util.CacheUtil
|
import dorkbox.util.CacheUtil
|
||||||
|
import mu.KotlinLogging
|
||||||
import suwayomi.tachidesk.server.ServerConfig
|
import suwayomi.tachidesk.server.ServerConfig
|
||||||
import suwayomi.tachidesk.server.generated.BuildConfig
|
import suwayomi.tachidesk.server.generated.BuildConfig
|
||||||
import suwayomi.tachidesk.server.serverConfig
|
import suwayomi.tachidesk.server.serverConfig
|
||||||
@@ -17,6 +18,7 @@ import suwayomi.tachidesk.server.util.Browser.openInBrowser
|
|||||||
import suwayomi.tachidesk.server.util.ExitCode.Success
|
import suwayomi.tachidesk.server.util.ExitCode.Success
|
||||||
|
|
||||||
object SystemTray {
|
object SystemTray {
|
||||||
|
private val logger = KotlinLogging.logger { }
|
||||||
private var instance: SystemTray? = null
|
private var instance: SystemTray? = null
|
||||||
|
|
||||||
fun create() {
|
fun create() {
|
||||||
@@ -60,7 +62,7 @@ object SystemTray {
|
|||||||
|
|
||||||
systemTray
|
systemTray
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
logger.error(e) { "create: failed to create SystemTray due to" }
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user