3 ms·
Like Go, the error is just returned from the function. The Result<> type is literally defined as “either an error value or a success value”. It’s up to the cal
by josephg 5y ago
Like Go, the error is just returned from the function. The Result<> type is literally defined as “either an error value or a success value”.
It’s up to the caller what to do with an error - panic, return it in turn, wrap it, or whatever else makes sense in context. It’s semantically quite similar to Go - except with better library support (Result instead of returning a tuple) and better syntax (the “?” operator instead of manual checks).