Commit 17a3880c authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

added custom exceptions

parent 345acb4f
package com.biganto.visual.roompark.domain.contract
import com.biganto.visual.roompark.domain.model.AuthInfoModel
import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.core.Observable
/**
* Created by Vladislav Bogdashkin on 24.09.2019.
*/
interface AuthContract {
// fun signInt(email:String,password:String): Observable<AuthInfoModel>
fun signIn(email:String,password:String) : Observable<AuthInfoModel>
fun signOut() : Completable
}
\ No newline at end of file
package com.biganto.visual.roompark.domain.contract
import com.biganto.visual.roompark.domain.model.EstateModel
import io.reactivex.rxjava3.core.Observable
/**
* Created by Vladislav Bogdashkin on 24.09.2019.
*/
interface DealContract{
fun getFavorites() : Observable<List<EstateModel>>
}
\ No newline at end of file
package com.biganto.visual.roompark.domain.contract
import com.biganto.visual.roompark.domain.model.AlbumPreviewModel
import com.biganto.visual.roompark.domain.model.PhotoModel
import com.biganto.visual.roompark.domain.model.WebCamListModel
import com.biganto.visual.roompark.domain.model.WebCamModel
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.core.Single
/**
* Created by Vladislav Bogdashkin on 24.09.2019.
*/
interface DevProgressContract{
fun getProgressCards(): Single<List<AlbumPreviewModel>>
fun getProgressAlbumList(albumId:Int): Observable<List<AlbumPreviewModel>>
fun getAlbumPhoto(photoId:Int): Observable<PhotoModel>
fun getWebCamsList(): Single<WebCamListModel>
fun getWebCamStream(camId:Int): Single<WebCamModel>
}
\ No newline at end of file
package com.biganto.visual.roompark.domain.contract
import com.biganto.visual.roompark.domain.model.ArticlesPreviewModel
import com.biganto.visual.roompark.domain.model.FeedsHeaderModel
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.core.Single
/**
* Created by Vladislav Bogdashkin on 24.09.2019.
*/
interface FeedsContract{
fun fetchFeeds(): Single<FeedsHeaderModel>
fun fetchFeedObservable(id:Int): Observable<ArticlesPreviewModel>
fun getArticle(id:Int): Single<ArticlesPreviewModel>
}
\ No newline at end of file
package com.biganto.visual.roompark.domain.contract
/**
* Created by Vladislav Bogdashkin on 24.09.2019.
*/
interface SubscriptionContract{
fun subscribeTopic(
deviceToken:String,
topic:String
)
fun unSubscribeTopic(
deviceToken:String,
topic:String
)
}
\ No newline at end of file
package com.biganto.visual.roompark.domain.custom_exception
import androidx.annotation.StringRes
import com.biganto.visual.roompark.R
/**
* Created by Vladislav Bogdashkin on 09.04.2019.
*/
const val CUSTOM_API_ERROR_RESPONSE_CODE_100=100
const val CUSTOM_API_ERROR_RESPONSE_CODE_101=101
const val CUSTOM_API_ERROR_RESPONSE_CODE_102=102
const val CUSTOM_API_ERROR_RESPONSE_CODE_103=103
const val CUSTOM_API_ERROR_RESPONSE_CODE_104=104
const val CUSTOM_API_ERROR_RESPONSE_CODE_111=111
const val CUSTOM_API_ERROR_RESPONSE_CODE_112=112
const val CUSTOM_API_ERROR_RESPONSE_CODE_201=201
const val CUSTOM_API_ERROR_RESPONSE_CODE_202=202
const val CUSTOM_API_ERROR_RESPONSE_CODE_203=203
const val CUSTOM_API_ERROR_RESPONSE_CODE_204=204
const val CUSTOM_API_ERROR_RESPONSE_CODE_205=205
const val CUSTOM_API_ERROR_RESPONSE_CODE_206=206
const val CUSTOM_API_ERROR_RESPONSE_CODE_211=211
const val CUSTOM_API_ERROR_RESPONSE_CODE_212=212
const val CUSTOM_API_ERROR_RESPONSE_CODE_213=213
const val CUSTOM_API_ERROR_RESPONSE_CODE_221=221
const val CUSTOM_API_ERROR_RESPONSE_CODE_231=231
const val CUSTOM_API_ERROR_RESPONSE_CODE_TOUR_NOT_FOUND=2001
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_100_MESSAGE_ID= R.string.api_error_100
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_101_MESSAGE_ID=R.string.api_error_101
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_102_MESSAGE_ID=R.string.api_error_102
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_103_MESSAGE_ID=R.string.api_error_103
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_104_MESSAGE_ID=R.string.api_error_104
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_111_MESSAGE_ID=R.string.api_error_111
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_112_MESSAGE_ID=R.string.api_error_112
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_201_MESSAGE_ID= R.string.api_error_201
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_202_MESSAGE_ID=R.string.api_error_202
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_203_MESSAGE_ID=R.string.api_error_203
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_204_MESSAGE_ID=R.string.api_error_204
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_205_MESSAGE_ID=R.string.api_error_205
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_206_MESSAGE_ID=R.string.api_error_206
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_211_MESSAGE_ID=R.string.api_error_211
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_212_MESSAGE_ID=R.string.api_error_212
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_213_MESSAGE_ID=R.string.api_error_213
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_221_MESSAGE_ID=R.string.api_error_221
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_231_MESSAGE_ID=R.string.api_error_231
@StringRes
const val CUSTOM_API_ERROR_RESPONSE_CODE_TOUR_NOT_FOUND_MESSAGE_ID=R.string.api_error_2001
@StringRes
const val CUSTOM_API_ERROR_DEFAULT_MESSAGE_ID=R.string.api_error_default
sealed class CustomApiException(val code:Int,@StringRes val messageStringId: Int):Exception() {
class NotAuthorizedException() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_100
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_100_MESSAGE_ID)
class TokenSyntaxException() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_101
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_101_MESSAGE_ID)
class UserWithTokenNotFoundException() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_102
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_102_MESSAGE_ID)
class TokenEstimatedException() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_103
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_103_MESSAGE_ID)
class UserBannedException() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_104
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_104_MESSAGE_ID)
class WrongLoginException() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_111
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_111_MESSAGE_ID)
class WrongPasswordException() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_112
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_112_MESSAGE_ID)
class UnexpectedSubscriptionTopicId() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_201
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_201_MESSAGE_ID)
class SubcriptionAldreadyExists() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_202
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_202_MESSAGE_ID)
class DealCrmTimeoutException() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_203
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_203_MESSAGE_ID)
class DealCrmWrongAnswearFormatException() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_204
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_204_MESSAGE_ID)
class DealCrmError() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_205
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_205_MESSAGE_ID)
class SubscriptionDbException() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_206
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_206_MESSAGE_ID)
class WrongFeedException() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_211
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_211_MESSAGE_ID)
class ArticleNotFoundException() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_212
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_212_MESSAGE_ID)
class ArticleIdExpectedException() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_213
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_213_MESSAGE_ID)
class PhotoIdExpectedException() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_212
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_212_MESSAGE_ID)
class WrongZoneIdException() : CustomApiException(CUSTOM_API_ERROR_RESPONSE_CODE_231
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_231_MESSAGE_ID)
class TourByIdNotFoundException() : CustomApiException(
CUSTOM_API_ERROR_RESPONSE_CODE_TOUR_NOT_FOUND
,messageStringId= CUSTOM_API_ERROR_RESPONSE_CODE_TOUR_NOT_FOUND_MESSAGE_ID)
class UnknownCustomApiException(code: Int, @StringRes messageStringId:Int)
: CustomApiException(code,messageStringId)
}
......@@ -12,4 +12,43 @@
<string name="enter">ВХОД</string>
<string name="into">В</string>
<string name="private_office">ЛИЧНЫЙ КАБИНЕТ</string>
<!--region Custom Exception-->
<string name="api_error_100">Метод требует авторизации.</string>
<string name="api_error_101">Ошибка синтаксиса токена.</string>
<string name="api_error_102">Пользователь, указанный в авторизационном токене, не найден.</string>
<string name="api_error_103">Пользователь найден, но токен не подходит. Нужно переавторизоваться.</string>
<string name="api_error_104">Пользователь не подтвердил почту.</string>
<string name="api_error_111">Неверный логин</string>
<string name="api_error_112">Неверный пароль</string>
<string name="api_error_201">Неверный топик для подписки / отписки</string>
<string name="api_error_202">Попытка добавить уже существующую подписку</string>
<string name="api_error_203">Timeout соединения с CRM (метод получения сделок)</string>
<string name="api_error_204">Неверный формат ответа от CRM</string>
<string name="api_error_205">CRM вернул ошибку (указывается её код в ответе)</string>
<string name="api_error_206">Ошибка БД, невозможно осуществить подписку</string>
<string name="api_error_211">Неверное обозначение фида</string>
<string name="api_error_212">Статья не найдена</string>
<string name="api_error_213">Не был передан article_id</string>
<string name="api_error_221">Не передан или неверный album_id</string>
<string name="api_error_231">Неверный id зоны</string>
<string name="api_error_2001">Тур не найден!</string>
<string name="api_error_default">Неизвестная ошибка сервера!</string>
<string name="no_network_error">No network!</string>
<string name="unknown_error">Unexpected error!</string>
<string name="cant_load_item_error">Can\'t load item!</string>
<string name="object_not_found_error">Object not found!</string>
<string name="can_not_delete_tour_error">Can\'t Delete Tour!</string>
<string name="can_not_sync_tour_error">Can\'t sync tour!</string>
<string name="can_not_download_all_tours_error">Can\'t download tours!</string>
<string name="auth_data_requirments_failed">Login at least %d symbols
\nPassword at least %d symbols</string>
<!--endregion-->
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment