© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
A. FreemanPro Gohttps://doi.org/10.1007/978-1-4842-7355-5_15

15. Error Handling

Adam Freeman1  
(1)
London, UK
 
This chapter describes the way that Go deals with errors. I describe the interface that represents errors, show you how to create errors, and explain the different ways they can be handled. I also describe panicking, which is how unrecoverable errors are handled. Table 15-1 puts error handling in context.
Table 15-1

Putting Error Handling in Context

Question

Answer

What is it?

Go’s error handling allows exceptional conditions and failures to be represented and dealt with.

Why is it useful?

Applications will often encounter unexpected situations, and the error ...

Get Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.