emerged_entity
emerged_entity
CC#
Created by emerged_entity on 6/30/2024 in #help
FluentResults in the Domain layer
Hi everyone, in the API I am currently trying to develop with Clean Architecture, I would like to use FluentResults library to avoid throwing and processing exceptions in situations where errors are not unexpected. So in this case it seems reasonable to also have custom Errors defined in the Domain layer. In this case, there is an issue that in order to use FluentResults throughout the whole application, it will require to add this package to the Domain layer also which is considered a bad practice since we want to make independent of any other packages and self-sufficient. In this case, I see only the option to create some custom Result and Error types, create specific Errors and then map them to the FluentResults types in the upper layers, but this approach seems to add a lot of unnecessary complexity. So in this case is it a valid approach to just add the package to the Domain layer or is it rather really better not to do that? And maybe there are better options to handle this situation? Using custom Result and Errors in other layers too to resolve this seems like avoiding the final choice because I can't see any proper reasons of using custom types when there is a well tested library for it. Thank you for answering.
14 replies
CC#
Created by emerged_entity on 8/18/2023 in #help
❔ What type of architecture to use in project?
7 replies