Lesson 28. To err is human

After reading lesson 28, you’ll be able to

  • Write files and handle failure
  • Handle errors with a flair of creativity
  • Make and identify specific errors
  • Keep calm and carry on

The sirens sound. Students and teachers shuffle out of classrooms to the nearest exit and congregate at the muster point. There’s no danger in sight and nothing is on fire. It’s another routine fire drill. Everyone is better prepared in the event of a real emergency.

File not found, invalid format, the server is unreachable. What does software do when something goes wrong? Maybe the problem can be extinguished, allowing operations to carry on as usual. Perhaps the best course of action is to exit safely, closing doors on the way out—or crash ...

Get Get Programming with Go now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.