Skip to content
masterclass Buddy

Go · Interface

error

Go errors can wrap other errors to add context while preserving the original cause. Use errors.Is and errors.As to inspect the full error chain.

Last updated

Since
Go 1.13

Syntax

func (e *QueryError) Unwrap() error
errors.Is(err, target)
errors.As(err, target)
errors.Unwrap(err)
fmt.Errorf("context: %w", err)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • error
  • Unwrap
  • errors.Is
  • errors.As
  • errors.Unwrap
  • fmt.Errorf

Source: Working with Errors in Go 1.13. Checked 2026-11-03.