Its a good idea to be aware of all of the subclasses of SystemCallError1 which are defined in the Errno2 module. It is easier when using system calls to rescue from StandardError, but sometimes if we want to catch and respond to very specific error conditions (like the file system is read-only Errno::EROFS or the disk is full on the device you are trying to write to Errno::ENOSPC). Also, rescuing from SystemCallError is more specific than StandardError.

This blog post on honeybadger.io is useful.

  1. https://ruby-doc.org/core-2.4.0/SystemCallError.html

  2. https://ruby-doc.org/core-2.4.0/Errno.html