Tagged articles
3 articles
Page 1 of 1
FunTester
FunTester
Aug 22, 2024 · Fundamentals

Master Go Error Handling: Built-in Errors, Wrapping, and Panic/Recover

This article explains Go's unique error handling approach, covering the built-in error interface, creating errors with errors.New, wrapping errors using fmt.Errorf, defining custom error types, logging errors with the log package, and managing severe failures with panic and recover, complete with practical code examples.

Error HandlingGocustom error
0 likes · 15 min read
Master Go Error Handling: Built-in Errors, Wrapping, and Panic/Recover
政采云技术
政采云技术
Dec 2, 2021 · Backend Development

Understanding Go's Error Handling: Design, Best Practices, and Common Pitfalls

This article explains the design of Go's error type, why errors are returned as pointers, compares error handling across languages, discusses panic, wild goroutines, sentinel and custom errors, and presents practical guidelines such as processing errors once, eliminating redundant checks, and wrapping errors for richer context.

BackendError Handlingbest practices
0 likes · 13 min read
Understanding Go's Error Handling: Design, Best Practices, and Common Pitfalls
ITPUB
ITPUB
Mar 29, 2016 · Fundamentals

Mastering Go Error Handling: From Basic Returns to Elegant State Management

The article explains Go's lack of try/catch, demonstrates how to use error return values with examples, shows how to create custom error types, and presents an optimized pattern that aggregates error checks to produce cleaner, more efficient code without performance loss.

BackendGoGolang
0 likes · 5 min read
Mastering Go Error Handling: From Basic Returns to Elegant State Management