DEV Community

Discussion on: Error handling - Returning Results

Collapse
 
dubyabrian profile image
W. Brian Gourlie

As much as I would love to use a Result type in languages like Java and C#, the type system does not accommodate them. Furthermore, using a Result type in a language that already has exceptions means you have to contend with both error handling mechanisms. The very basic requirement for a Result type is a) algebraic data types and b) exhaustive pattern matching. Without these, you really shouldn't bother.

Collapse
 
courier10pt profile image
Bob van Hoove

When I use / see a Result object, I expect the callee to take care of exceptions. But indeed, that's not a given.

Collapse
 
rmorschel profile image
Robert Morschel

Exactly!