ui: always show visible localized error messages

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2023-04-07 15:22:00 +02:00
parent 8669ae78e1
commit 3c834ac8e3

View File

@ -92,8 +92,8 @@ object ErrorMessages {
rootCause is ChecksumException -> { rootCause is ChecksumException -> {
resources.getString(R.string.error_qr_checksum) resources.getString(R.string.error_qr_checksum)
} }
rootCause.message != null -> { rootCause.localizedMessage != null -> {
rootCause.message!! rootCause.localizedMessage!!
} }
else -> { else -> {
val errorType = rootCause.javaClass.simpleName val errorType = rootCause.javaClass.simpleName
@ -109,7 +109,7 @@ object ErrorMessages {
if (kfe!!.type == KeyFormatException.Type.LENGTH) return resources.getString(KFE_FORMAT_MAP.getValue(kfe.format)) if (kfe!!.type == KeyFormatException.Type.LENGTH) return resources.getString(KFE_FORMAT_MAP.getValue(kfe.format))
} else if (bce.cause is ParseException) { } else if (bce.cause is ParseException) {
val pe = bce.cause as ParseException? val pe = bce.cause as ParseException?
if (pe!!.message != null) return ": ${pe.message}" if (pe!!.localizedMessage != null) return ": ${pe.localizedMessage}"
} else if (bce.location == BadConfigException.Location.LISTEN_PORT) { } else if (bce.location == BadConfigException.Location.LISTEN_PORT) {
return resources.getString(R.string.bad_config_explanation_udp_port) return resources.getString(R.string.bad_config_explanation_udp_port)
} else if (bce.location == BadConfigException.Location.MTU) { } else if (bce.location == BadConfigException.Location.MTU) {