Combine all known API error messages in a UI error message
This commit is contained in:
parent
161a599c18
commit
ea392ab8ae
|
@ -197,12 +197,12 @@ fun ErrorEntity.toException(
|
|||
// Auto-format the validation error
|
||||
// messages to something user-friendly.
|
||||
val validationError = validationErrors?.toMap()?.format()
|
||||
val generalError = errorModel?.message ?: errorDescription ?: error
|
||||
val message = if (validationError != null) {
|
||||
"$generalError\n\n$validationError"
|
||||
} else {
|
||||
generalError
|
||||
}
|
||||
val message = listOfNotNull(
|
||||
errorModel?.message,
|
||||
errorDescription,
|
||||
error,
|
||||
validationError
|
||||
).joinToString(separator = "\n")
|
||||
ApiException(
|
||||
exception = exception,
|
||||
code = code,
|
||||
|
|
Loading…
Reference in New Issue