module SystemError

Overview

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

It adds an #os_error property that contains the original system error. It provides several constructor methods that set the #os_error value:

An error message is automatically constructed based on the system error message.

For example:

class MyError < Exception
  include SystemError
end

MyError.from_errno("Something happened")

Customization

Including classes my override several protected methods to customize the instance creation based on OS errors:

Direct including types

Defined in:

system_error.cr

Instance Method Summary

Instance Method Detail

def os_error : Errno | WinError | WasiError | Nil #

The original system error wrapped by this exception


[View source]