Created
March 6, 2018 06:48
-
-
Save iblinov65apps/39715dcc98ff787022310a7e9f328701 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ru.alexfitness.presentation.core.utils; | |
import android.support.annotation.StringRes; | |
import ru.alexfitness.presentation.core.view.ErrorView; | |
public interface ErrorHandlerCreator { | |
Builder newBuilder(ErrorView errorView, Throwable throwable); | |
Builder defaultBuilder(ErrorView errorView, Throwable throwable); | |
interface ErrorHandler { | |
void handleErrors(); | |
} | |
interface Builder { | |
Builder checkNetworkErrors(); | |
Builder checkApiExceptions(); | |
Builder apiCodeExceptionListener(OnApiCodeExceptionListener listener); | |
Builder anotherThrowableListener(OnAnotherThrowableListener listener); | |
Builder anyThrowableListener(OnAnyThrowableListener listener); | |
Builder defaultError(@StringRes int defaultErrorRes); | |
ErrorHandler build(); | |
} | |
interface OnApiCodeExceptionListener { | |
void onApiCodeException(int code); | |
} | |
interface OnAnotherThrowableListener { | |
/** | |
* Tries to handle throwable. If not, throwable is handled by standard way. | |
* @param throwable Throwable | |
* @return Whether or not throwable was handled. | |
*/ | |
boolean handleThrowable(Throwable throwable); | |
} | |
interface OnAnyThrowableListener { | |
void handleThrowable(Throwable throwable); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment