RANIARANIA Academy

Error Handling & Idiomatic Go

Write robust, idiomatic Go by treating errors as ordinary values you return, check, wrap and inspect. You will master fmt.Errorf with %w, errors.Is and errors.As, sentinel and custom error types, disciplined panic/recover, and the effective-Go style that reviewers expect.

Watch the free preview

The error interface and returning errors — free to watch, no account needed.

Go (Golang) INTERMEDIATE · 150 min · Certificate on completion · 3 CPD points

What you'll learn

  • Write robust, idiomatic Go that returns and handles errors as ordinary values
  • Wrap errors with fmt.Errorf and %w to preserve context and cause
  • Inspect error chains correctly with errors.Is and errors.As
  • Design sentinel errors and custom error types for a clean public API
  • Use panic and recover sparingly and follow effective-Go style

Syllabus

Errors Are Values
The error interface and returning errorsFree preview15 min
Checking, comparing and formatting errors15 min
Wrapping and Inspecting Errors
Wrapping errors with fmt.Errorf and %w15 min
errors.Is and errors.As15 min
Designing Error Values
Sentinel errors15 min
Custom error types15 min
Panics and Idiomatic Style
panic and recover, used sparingly15 min
Idioms and effective-Go style15 min
Lab — 10 Exercises & Solutions
Exercises 1–515 min
Exercises 6–1015 min