Make exceptions anonymous where they're not used
This commit is contained in:
parent
e90c9c1bb0
commit
0e4772873a
|
@ -121,4 +121,4 @@ val SnowyConfigScreen: Screen = object: Screen(translationComponent) {
|
|||
)
|
||||
}
|
||||
}.build()
|
||||
} catch (e: ClassNotFoundException) { field }
|
||||
} catch (_: ClassNotFoundException) { field }
|
|
@ -62,7 +62,7 @@ object Configuration {
|
|||
setReadable(true)
|
||||
} else try {
|
||||
result = parseFile(file)
|
||||
} catch (e: ConfigException) {
|
||||
} catch (_: ConfigException) {
|
||||
Snowy.logs.warn("Could not parse the snowy configuration file, the default configuration will be used instead.")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,10 +41,10 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) {
|
|||
*Snowy.annotatedButtons.mapNotNull {
|
||||
try {
|
||||
it.getConstructor().newInstance()
|
||||
} catch (e: NoSuchMethodException) {
|
||||
} catch (_: NoSuchMethodException) {
|
||||
try {
|
||||
it.getDeclaredField("INSTANCE").get(null)
|
||||
} catch (e: NoSuchFieldException) {}
|
||||
} catch (_: NoSuchFieldException) {}
|
||||
} as? ButtonImpl
|
||||
}.plus(Configuration.foundMacros).toTypedArray()
|
||||
)
|
||||
|
|
|
@ -22,7 +22,7 @@ object DiscordRPC: ButtonImpl() {
|
|||
try {
|
||||
discord_rpc.discordInitialize("839058922102849538", RPCHandlers, true)
|
||||
Runtime.getRuntime().addShutdownHook(Thread { discord_rpc.discordShutdown() })
|
||||
} catch (e: UnsatisfiedLinkError) {
|
||||
} catch (_: UnsatisfiedLinkError) {
|
||||
Snowy.logs.error("Could not initialize DiscordRPC because the needed libraries are not present on your operating system; the feature will therefore be disabled.")
|
||||
isDisabled = true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue