Posts tagged as Go Errors

Error Handling in GO – Part 3

Error Handling and Abstracting in GO - Part 3

Chapter 3 – Writing a Custom Error Type In the first chapter, we learned the basics of errors in go. How to create an error with a particular message. Then we looked into exposing different types of errors in our packages so that consumers of our code can handle them differently, if appropriate. In the… Read more »

Error Handling in GO – Part 2

Error in Golang Part 2

Chapter 2: Using fmt.errorf to Wrap Sentinel Errors of the Interface We finished the previous chapter of this series with returning Sentinel error values, and noticed that we may want to provide additional information to the user. We learned that sentinel errors are values of type error you can expose within your go project  by… Read more »

Error Handling in GO

Error Handling & Abstraction in GO

GO uses its capability to return multiple values for error handling, meaning that errors in go are regular values returned from a function. The developer must check the returned error value and handle it accordingly. Error handling can quickly become non-trivial. You may want to change your behaviour if an error occurs, either substitute the… Read more »