DEV Community

Cover image for Use error decorators to simplify Go error handling
Jonathan Hall
Jonathan Hall

Posted on

Use error decorators to simplify Go error handling

#go

Imagine you've written a Retry function that accepts a callback function as an argument, and executes it in a loop until success. Now further imagine that some errors should not be retried. Learn how to use a simple custom error type implimentation as a decorator type, to simplify this type of logic.

Top comments (0)