Some inspiration from the “Domain Modeling Made Functional” book:
There are two ways of dealing with errors and exceptions inside functions when programming one in the most obvious is to return a result type like in rust, another one is to make sure that the function when it receives an input the input is already validated and not by trusting it but by using a specific type.
This later approach is useful and usable in languages that can enforce type that compile time, But can be very elegant, it’s shown in the book about functional domain driven design
The first one, that return result is called “extending the output”, while the other, which deals with the input is called “restricting the input”