Skip to content

Instantly share code, notes, and snippets.

@raamcosta
Last active November 27, 2021 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raamcosta/002c725da155d32e3d3dc48eab0d92c9 to your computer and use it in GitHub Desktop.
Save raamcosta/002c725da155d32e3d3dc48eab0d92c9 to your computer and use it in GitHub Desktop.
Error handling - Common approach
sealed class Result<T> {
data class Success<T>(val data: T) : Result<T>()
data class Error<T>(val error: SomeErrorType) : Result<T>()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment