Error Handling
This chapter is about dealing with errors and panics in a concurrent program. First, we will look at how error handling can be incorporated into concurrent programs, including how to pass errors between goroutines so that you can handle or report them. Then we will talk about panics.
There are no hard and fast rules about dealing with errors and panics, but I hope some of the guidelines described in this chapter will help you write more robust code. The first guideline is this: never ignore errors. The second guideline tells you when to return an error and when to panic: the audience for errors is the users of the program; the audience for panics is the developers of the program.
This chapter contains the following sections:
- Error handling
- Panics
At the end of this chapter, you will have seen several approaches to error handling in concurrent programs.