Thread
#android-architecture
    s

    sergey.trufanov

    3 years ago
    Hi there. I have a question about clean architecture. Which module (
    data
    ,
    domain
    ,
    presentation
    ) is responsible for handling API errors, for example if I have API method
    /login
    and it returns error
    Email is incorrect
    where should I handle it? I guess in repository inside
    data
    module/layer, but maybe I missed smth.
    henrikhorbovyi

    henrikhorbovyi

    3 years ago
    I use to do that handling on domain layer. It make sense for me because it is near to the
    presentation
    layer, and
    presentation
    will only comsume those exceptions coming from
    domain
    and show it for the user in someway. (I'm not sure if my thoughts are correct. 😄 Just sharing my option) Anyway, I'm curious about other point of view 🙂
    rkeazor

    rkeazor

    3 years ago
    Domain layer I believe
    n

    nounours

    3 years ago
    I would do it in domain layer too. IMHO, data should be responsible to serve raw data, and the domain layer should handle it accordingly to the domain rules, given by the person responsible for it i your org (Product Owner, business, etc etc)
    s

    sergey.trufanov

    3 years ago
    Thank you guys for your answers. Will handle it in
    domain
    , agree with @nounours
    g

    ghedeon

    3 years ago
    Hm, I'd say in
    data
    and optionally in domain, no? You don't want api exeptions in
    domain
    because that's dependency leak. You handle it once in
    data
    , map it to some sort of error model from domain. Then, in
    domain
    itself you can do something with it, or just pass it to
    ui
    and
    ui
    will map it to its own models.