Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Working with Errors

Gopher Academy via YouTube

Overview

Explore the intricacies of error handling in Go 1.13 through this GopherCon 2020 talk by Jonathan Amsterdam. Dive into the concept of wrapped errors, understanding when and how to use them effectively. Learn about the new functions and formatting directive introduced to support error wrapping, and their impact on error return and handling practices. Discover techniques for incorporating additional features like stack traces, error codes, and custom formatting into your error packages. Gain insights on best practices for annotating errors, using the errors.As function, and implementing user-facing error handling. Examine the challenges and considerations in moving to wrapped errors, including potential pitfalls and formatting issues. Enhance your Go programming skills with practical examples and expert guidance on working with errors in modern Go development.

Syllabus

Intro
Wrapping and the error chain
Error-wrapping support in Go 1.13
Two audiences for errors
A Config struct
Returning errors unadorned
User-facing function
Deciding with errors before 1.13
Annotating errors
Error wrapping
Wrapping errors in Go 1.13
Use errors. As instead of type assertions
Under the hood
Moving to Wrapped Errors
Wrapping Returned Errors
Did we go too far?
Errors and Codes
Stack trace example
Stack trace problems
We tried...
How we don't do it
Execution Traces With Wrap
Standard Formatting
Detailed Formatting
Formatting Removed
Detail Formatting with fmt. Formatter
References

Taught by

Gopher Academy

Reviews

Start your review of Working with Errors

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.