Kulwinder Singh
07/03/2019, 12:37 PMEqualizer
class, so in Equalizer class most of the getters/setters throws
this 4-5 exceptions
. so to access single value i have to add much coderibesg
07/03/2019, 12:46 PMfun getCurrentBass(): Short = try {
mBassBoost!!.roundedStrength
} catch (e: Exception) {
when (e) {
is UnsupportedOperationException -> 0
is IllegalStateException -> 0
is IllegalArgumentException -> 0
is java.lang.RuntimeException -> 0
else -> 42
}
}
}
karelpeeters
07/03/2019, 12:47 PMelse -> throw e
Kulwinder Singh
07/03/2019, 12:48 PMException
?karelpeeters
07/03/2019, 12:48 PMIllegalArgumentException
is meant to indicate a code error, so it's never meant to be caught.streetsofboston
07/03/2019, 12:51 PMKulwinder Singh
07/03/2019, 12:53 PMroundedStrength
throws
all of these exceptions and if i don't catch
IllegalArgumentException
then how it should be handledkarelpeeters
07/03/2019, 12:56 PMIllegalArgumentException
just means the program is wrong, there's no point is hiding that and silently returning 0
.Kulwinder Singh
07/03/2019, 12:58 PMexceptions
but also i'm not sure about IllegalArgumentException
so i have also handled this for safetykarelpeeters
07/03/2019, 12:59 PMribesg
07/03/2019, 1:01 PMKulwinder Singh
07/03/2019, 1:01 PMIllegalArgumentException
?diesieben07
07/03/2019, 1:02 PMribesg
07/03/2019, 1:02 PMdiesieben07
07/03/2019, 1:03 PMKulwinder Singh
07/03/2019, 1:03 PMribesg
07/03/2019, 1:03 PMdiesieben07
07/03/2019, 1:03 PMribesg
07/03/2019, 1:03 PMdiesieben07
07/03/2019, 1:03 PMKulwinder Singh
07/03/2019, 1:05 PMcatching
itVlad
07/03/2019, 1:15 PMThread.UncaughtExceptionHandler
might be useful
https://developer.android.com/reference/java/lang/Thread.UncaughtExceptionHandlermikaelquick
07/03/2019, 4:34 PM