Skip to content

module SystemError

This module can be included in any Exception subclass that is used to wrap some system error (Errno or WinError)

When included it provides a from_errno method (and from_winerror on Windows) to create exception instances with a description of the original error. It also adds an os_error property that contains the original system error.

For example:

class MyError < Exception
  include SystemError
end

MyError.from_errno("Something happened")

Direct including types

IO::Error RuntimeError

Methods

#os_error : Errno | WinError | Nil

The original system error wrapped by this exception

View source