Skip to content

Commit 47a7336

Browse files
committed
Show useful error messages
1 parent b817abf commit 47a7336

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Diff for: app/src/main/java/com/tomclaw/appsend_rb/screen/apps/AppsInteractor.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ class AppsInteractorImpl(
148148
APPS_DIR_NAME
149149
)
150150
if (!(directory.exists() || directory.mkdirs())) {
151-
emitter.onError(IOException("unable to create directory"))
151+
emitter.onError(IOException("unable to create directory " + directory.name))
152152
return@create
153153
}
154154
val destination = File(directory, getApkName(entity))
155155
if (destination.exists() && !destination.delete()) {
156-
emitter.onError(IOException("unable to delete destination file"))
156+
emitter.onError(IOException("unable to delete destination file " + destination.name))
157157
return@create
158158
}
159159
val buffer = ByteArray(524288)

Diff for: app/src/main/java/com/tomclaw/appsend_rb/screen/apps/AppsPresenter.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ class AppsPresenterImpl(
189189
.subscribe({ file ->
190190
router?.shareApk(file)
191191
}, {
192-
view?.showAppExportError()
192+
view?.showAppExportError(it.message.toString())
193193
})
194194
}
195195

@@ -202,7 +202,7 @@ class AppsPresenterImpl(
202202
.subscribe({ file ->
203203
view?.showExtractSuccess(file.path)
204204
}, {
205-
view?.showAppExportError()
205+
view?.showAppExportError(it.message.toString())
206206
})
207207
}
208208

Diff for: app/src/main/java/com/tomclaw/appsend_rb/screen/apps/AppsView.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ interface AppsView {
4747

4848
fun showAppLaunchError()
4949

50-
fun showAppExportError()
50+
fun showAppExportError(msg: String)
5151

5252
fun showNoRequestedPermissionsMessage()
5353

@@ -183,8 +183,8 @@ class AppsViewImpl(
183183
Snackbar.make(recycler, R.string.non_launchable_package, Snackbar.LENGTH_LONG).show()
184184
}
185185

186-
override fun showAppExportError() {
187-
Snackbar.make(recycler, R.string.app_extract_failed, Snackbar.LENGTH_LONG).show()
186+
override fun showAppExportError(msg: String) {
187+
Snackbar.make(recycler, msg, Snackbar.LENGTH_LONG).show()
188188
}
189189

190190
override fun showNoRequestedPermissionsMessage() {

0 commit comments

Comments
 (0)