LANGUAGES Signal 458
Signatures, be true: domain errors and functional handling in Kotlin
The proposal is to return Either<DocumentSignError, Unit> from Kotlin functions so that expected failures are visible in the signature.
Making domain errors explicit in the function signature aligns with Salmon’s engineering culture of real ownership and high standards, preventing hidden failures from reaching production. It allows callers to handle every expected outcome without digging into implementation details.
Written by elseif from the cluster below · every claim links back to a sourceThe three things worth knowing
The function signature should return Either<DocumentSignError, Unit> to make domain errors visible.
Domain errors are failures where the client behaved correctly but the operation cannot succeed, such as an invalid signing code, a closed window, or an already-signed document.
Other failure categories, client errors and unexpected exceptions, are handled via HTTP responses or operational signals, not placed in the domain model.
THE CLUSTER
↗