Hey there, I would like to improve my error handli...
# arrow
a
Hey there, I would like to improve my error handling on this function :
Copy code
class TypeRef
...
  fun DeclarationRepository.resolve(): TypeRef = findDeclarationByName<NameableDeclaration>(typeName)
    ?.let { ResolvedTypeRef(typeName, it) }
    ?: (UnresolvedTypeRef(typeName)
       .also { logger.warn { "fail to resolve type : $it" } })
Instead of logging what wrong, i want to return UnresolvedTypeRef with a TypeNotResolve as error to process it on higher layer of code. Ior seem like what i need https://arrow-kt.io/learn/typed-errors/either-and-ior/ but from the documentation, I dont get how to use the DSL. Anybody could help ?