Posted on 10th September 2024|33 views
How to wrap errors
Posted on 10th September 2024| views
In Golang, “error” package supports error wrapping directly. To wrap an error, use %w that makes it available to errors.Is and errors.As:
err:= fmt.Errorf("access denied: %w", ErrPermission)