Advertisement
Guest User

Untitled

a guest
May 26th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. /**
  2. * Base Class for handling errors/failures/exceptions.
  3. * Every feature specific failure should extend [FeatureFailure] class.
  4. */
  5. sealed class Failure(val exception: Exception = Exception("Failure")) {
  6. object None : Failure()
  7. object NetworkConnection : Failure()
  8. object ServerError : Failure()
  9.  
  10. /** * Extend this class for feature specific failures.*/
  11. open class FeatureFailure(featureException: Exception = Exception("Feature failure")) : Failure(featureException)
  12.  
  13. override fun equals(other: Any?): Boolean {
  14. return other is Failure
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement