Replies: 4 comments
-
To manage the backend with FIREBASE we are not going to use additional exceptions that already come to us by default. We can start implementing Kotlin Result, and in the case that we have to consume an API with a custom error handler we could choose |
Beta Was this translation helpful? Give feedback.
-
My main issue with exceptions is that, even if properly annotated with
I think that as long as we remain consistent, this shouldn't be too much of a problem. |
Beta Was this translation helpful? Give feedback.
-
About the coment of @deanayac → I think we should not pass any external datasource exception to the domain or presentation layer. It will be clean to cast/map them to custom error objects or exceptions. About @Bruno125 → Yeah. I see that for building features that other devs will use, having non-checked exceptions could guide us to errors. Now, @Bruno125 @deanayac1987, right now there's a custom ResultType class in the code base, it accepts generics (in my experiences, I had to fight to find the implementations in the IDE), should we still use it or should we go with Kotlin Result class? |
Beta Was this translation helpful? Give feedback.
-
After some experience coding with both approaches, I'm going with the use of Kotlin Result class. The exception will be mapped in an ErrorMapped to a custom Error class. Closing discussion. |
Beta Was this translation helpful? Give feedback.
-
Hello there!
Opening discussion about the use of Kotlin Result class or throwing exceptions in the domain layer of the app.
Both have advantages and disadvantages. I will write some of then:
Advantages
Disadvantages
getUser
function returns anUser
object and not aResult<User>
object.Example
Let's take a look of differences:
What do you think?
IMHO, I think throwing exceptions work very good in most of the cases and should be the way to go for the project, but I'm open to read different point of views.
Beta Was this translation helpful? Give feedback.
All reactions