diff --git a/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/exception/TiebaLocalException.kt b/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/exception/TiebaLocalException.kt index d9553323..f6400ffd 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/exception/TiebaLocalException.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/exception/TiebaLocalException.kt @@ -1,6 +1,6 @@ package com.huanchengfly.tieba.post.api.retrofit.exception -class TiebaLocalException( +open class TiebaLocalException( override val code: Int, msg: String ) : TiebaException(msg) \ No newline at end of file diff --git a/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/exception/TiebaNotLoggedInException.kt b/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/exception/TiebaNotLoggedInException.kt new file mode 100644 index 00000000..5bad528c --- /dev/null +++ b/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/exception/TiebaNotLoggedInException.kt @@ -0,0 +1,7 @@ +package com.huanchengfly.tieba.post.api.retrofit.exception + +import com.huanchengfly.tieba.post.api.Error.ERROR_NOT_LOGGED_IN + +class TiebaNotLoggedInException( + msg: String = "Not logged in!" +) : TiebaLocalException(ERROR_NOT_LOGGED_IN, msg) \ No newline at end of file diff --git a/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/interceptors/ForceLoginInterceptor.kt b/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/interceptors/ForceLoginInterceptor.kt index 7d763ec0..ad9a2308 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/interceptors/ForceLoginInterceptor.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/api/retrofit/interceptors/ForceLoginInterceptor.kt @@ -1,8 +1,7 @@ package com.huanchengfly.tieba.post.api.retrofit.interceptors -import com.huanchengfly.tieba.post.api.Error.ERROR_NOT_LOGGED_IN import com.huanchengfly.tieba.post.api.Header -import com.huanchengfly.tieba.post.api.retrofit.exception.TiebaLocalException +import com.huanchengfly.tieba.post.api.retrofit.exception.TiebaNotLoggedInException import com.huanchengfly.tieba.post.utils.AccountUtil import okhttp3.Interceptor import okhttp3.Response @@ -23,7 +22,7 @@ object ForceLoginInterceptor : Interceptor { } if (forceLogin && !AccountUtil.isLoggedIn()) { - throw TiebaLocalException(ERROR_NOT_LOGGED_IN, "Not logged in.") + throw TiebaNotLoggedInException() } return chain.proceed(