Prioritize showing error description over error
This commit is contained in:
parent
42dab0318b
commit
97ff7e84ad
|
@ -199,15 +199,14 @@ fun ErrorEntity.toException(
|
||||||
// messages to something user-friendly.
|
// messages to something user-friendly.
|
||||||
val errorTitle = kotlin.run {
|
val errorTitle = kotlin.run {
|
||||||
errorModel?.message?.takeIf { it.isNotBlank() }
|
errorModel?.message?.takeIf { it.isNotBlank() }
|
||||||
?: error.takeIf { it.isNotBlank() }
|
?: errorDescription?.takeIf { it.isNotBlank() }
|
||||||
// We usually should get an error message, but
|
// We usually should get an error message, but
|
||||||
// just in case resort to the basic message.
|
// just in case resort to the basic message.
|
||||||
?: code.description
|
?: "${code.description}: $error"
|
||||||
}.trim()
|
}.trim()
|
||||||
val errorText = kotlin.run {
|
val errorText = kotlin.run {
|
||||||
val validation = validationErrors?.toMap()?.format()?.takeIf { it.isNotBlank() }
|
val validation = validationErrors?.toMap()?.format()?.takeIf { it.isNotBlank() }
|
||||||
val message = listOfNotNull(
|
val message = listOfNotNull(
|
||||||
errorDescription?.takeIf { it.isNotBlank() },
|
|
||||||
validation,
|
validation,
|
||||||
)
|
)
|
||||||
.joinToString(separator = "\n")
|
.joinToString(separator = "\n")
|
||||||
|
|
Loading…
Reference in New Issue