Session

Leveraging Typed Exceptions for Cleaner Error Handling

Harnessing Errors & Edge-Cases with Ease & Elegance.

Imagine handling error conditions and unexpected edge-cases with code that is easier to read, maintain & extend.

The temptation is real.

We create methods that return an array of objects, or "false" if nothing was found. Or "null". We might further "signal" unexpected results or error-conditions with integer values.

It then becomes the responsibility of consumers of these methods, to properly interpret what "false", "null", or "-500" mean.

As a result, we produce code that is difficult to read, maintain and extend.

Exceptions are seldom leveraged, and most often thought of as objects thrown by some frameworks for instrumentation.

When properly leveraged, they however offer an opportunity to manage unexpected and edge-case behavior at various layers of our applications, with elegant control flows.

By leveraging your language's Exceptions alongside its "Type System", we can create elegant, flexible and advanced handling of Error conditions, which will promote code that is easier to work with.

Chris Holland

Director, Engineering, TriNet

View Speaker Profile

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top