Skip to content

Commit

Permalink
Show useful error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
fulmeek committed Mar 13, 2022
1 parent b817abf commit 47a7336
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ class AppsInteractorImpl(
APPS_DIR_NAME
)
if (!(directory.exists() || directory.mkdirs())) {
emitter.onError(IOException("unable to create directory"))
emitter.onError(IOException("unable to create directory " + directory.name))
return@create
}
val destination = File(directory, getApkName(entity))
if (destination.exists() && !destination.delete()) {
emitter.onError(IOException("unable to delete destination file"))
emitter.onError(IOException("unable to delete destination file " + destination.name))
return@create
}
val buffer = ByteArray(524288)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class AppsPresenterImpl(
.subscribe({ file ->
router?.shareApk(file)
}, {
view?.showAppExportError()
view?.showAppExportError(it.message.toString())
})
}

Expand All @@ -202,7 +202,7 @@ class AppsPresenterImpl(
.subscribe({ file ->
view?.showExtractSuccess(file.path)
}, {
view?.showAppExportError()
view?.showAppExportError(it.message.toString())
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ interface AppsView {

fun showAppLaunchError()

fun showAppExportError()
fun showAppExportError(msg: String)

fun showNoRequestedPermissionsMessage()

Expand Down Expand Up @@ -183,8 +183,8 @@ class AppsViewImpl(
Snackbar.make(recycler, R.string.non_launchable_package, Snackbar.LENGTH_LONG).show()
}

override fun showAppExportError() {
Snackbar.make(recycler, R.string.app_extract_failed, Snackbar.LENGTH_LONG).show()
override fun showAppExportError(msg: String) {
Snackbar.make(recycler, msg, Snackbar.LENGTH_LONG).show()
}

override fun showNoRequestedPermissionsMessage() {
Expand Down

0 comments on commit 47a7336

Please sign in to comment.