© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
B. Feigenbaum, Ph.D.Go for Java Programmershttps://doi.org/10.1007/978-1-4842-7199-5_7

7. Errors and Panics

Barry Feigenbaum, Ph.D.1  
Austin, TX, USA

In this chapter, we will drill down on Go’s error detection and recovery features and how they differ from Java’s approach. When you have completed this chapter, you should be able to clearly identify the similarities and differences between the Go and Java error approaches.

Code, especially code in functions, can exit in several ways:
  1. 1.

    Success – The function was accomplished as expected.

  2. 2.

    Failure – The function was not accomplished as expected due to some predictable situation.

  3. 3.

    Gross failure (aka panics ...

Get Go for Java Programmers: Learn the Google Go Programming Language 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.