Skip to content

Commit

Permalink
Improve code a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
tuomas2 committed Dec 14, 2024
1 parent 6e26f64 commit 11c9f75
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,12 @@ object SwordEnvironmentInitialisation {
}

private fun showMsg(ev: ReporterEvent?) {
val msg = if (ev == null) {
getResourceString(R.string.error_occurred)
} else if (!StringUtils.isEmpty(ev.message)) {
ev.message
} else if (ev.exception != null && !StringUtils.isEmpty(ev.exception.message)) {
getResourceString(R.string.error_occurred_with_link, ev.exception.message!!)
} else {
getResourceString(R.string.error_occurred)
val msg = when {
ev == null -> getResourceString(R.string.error_occurred)
!StringUtils.isEmpty(ev.message) -> ev.message
ev.exception != null && !StringUtils.isEmpty(ev.exception.message) ->
getResourceString(R.string.error_occurred_with_link, ev.exception.message!!)
else -> getResourceString(R.string.error_occurred)
}
// convert Throwable to Exception for Dialogs
val e: Exception = if (ev != null) {
Expand Down

0 comments on commit 11c9f75

Please sign in to comment.