fixed wrong exception throwing

This commit is contained in:
Mariotaku Lee 2017-05-14 21:25:15 +08:00
parent be2bde85cc
commit 3ac768724d
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
2 changed files with 4 additions and 3 deletions

View File

@ -20,12 +20,12 @@
package org.mariotaku.twidere.loader
import android.accounts.AccountManager
import android.content.ActivityNotFoundException
import android.content.Context
import android.support.v4.content.FixedAsyncTaskLoader
import org.mariotaku.microblog.library.MicroBlogException
import org.mariotaku.microblog.library.mastodon.Mastodon
import org.mariotaku.twidere.Constants
import org.mariotaku.twidere.exception.AccountNotFoundException
import org.mariotaku.twidere.extension.model.api.mastodon.toParcelable
import org.mariotaku.twidere.extension.model.newMicroBlogInstance
import org.mariotaku.twidere.model.ListResponse
@ -44,7 +44,7 @@ class MastodonSearchLoader(
val am = AccountManager.get(context)
val account = accountKey?.let {
AccountUtils.getAccountDetails(am, it, true)
} ?: throw ActivityNotFoundException()
} ?: throw AccountNotFoundException()
val mastodon = account.newMicroBlogInstance(context, Mastodon::class.java)
val searchResult = mastodon.search(query, true, null)
return ListResponse(ArrayList<Any>().apply {

View File

@ -27,6 +27,7 @@ import org.mariotaku.microblog.library.MicroBlogException
import org.mariotaku.microblog.library.twitter.model.Paging
import org.mariotaku.twidere.R
import org.mariotaku.twidere.constant.loadItemLimitKey
import org.mariotaku.twidere.exception.AccountNotFoundException
import org.mariotaku.twidere.extension.model.api.applyLoadLimit
import org.mariotaku.twidere.loader.iface.IPaginationLoader
import org.mariotaku.twidere.model.AccountDetails
@ -67,7 +68,7 @@ abstract class AbsRequestUsersLoader(
try {
val am = AccountManager.get(context)
details = accountKey?.let { AccountUtils.getAccountDetails(am, it, true) } ?:
throw ActivityNotFoundException()
throw AccountNotFoundException()
users = getUsersInternal(details)
} catch (e: MicroBlogException) {
DebugLog.w(tr = e)