Skip to content

Commit

Permalink
Show error message in error dialog, if provided (JSword reporter)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuomas2 committed Dec 14, 2024
1 parent 922e7ea commit 6e26f64
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,17 @@ object SwordEnvironmentInitialisation {
}

private fun showMsg(ev: ReporterEvent?) {
val msg: String?
msg = if (ev == null) {
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)) {
ev.exception.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)
}
// convert Throwable to Exception for Dialogs
val e: Exception
e = if (ev != null) {
val e: Exception = if (ev != null) {
val th = ev.exception
if (th is Exception) th else Exception("Jsword Exception", th)
} else {
Expand Down

0 comments on commit 6e26f64

Please sign in to comment.