Exception: Mach::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Mach::Error
- Includes:
- Functions
- Defined in:
- lib/mach/error.rb
Direct Known Subclasses
ABORTED, FAILURE, INVALID_ADDRESS, INVALID_ARGUMENT, INVALID_NAME, NO_SPACE, OPERATION_TIMED_OUT, PROTECTION_FAILURE
Defined Under Namespace
Classes: ABORTED, FAILURE, INVALID_ADDRESS, INVALID_ARGUMENT, INVALID_NAME, NO_SPACE, OPERATION_TIMED_OUT, PROTECTION_FAILURE
Instance Attribute Summary collapse
-
#errno ⇒ Object
readonly
Returns the value of attribute errno.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(msg, errno) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Methods included from Functions
attach_mach_function, error_check, error_check_bootstrap, new_memory_pointer, #new_memory_pointer
Methods included from Types
Constructor Details
#initialize(msg, errno) ⇒ Error
Returns a new instance of Error.
38 39 40 41 |
# File 'lib/mach/error.rb', line 38 def initialize(msg, errno) super(msg) @errno = errno end |
Instance Attribute Details
#errno ⇒ Object (readonly)
Returns the value of attribute errno.
36 37 38 |
# File 'lib/mach/error.rb', line 36 def errno @errno end |
Class Method Details
.new(msg, errno) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mach/error.rb', line 18 def self.new(msg, errno) klass = case errno when 1; then INVALID_ADDRESS when 2; then PROTECTION_FAILURE when 3; then NO_SPACE when 4; then INVALID_ARGUMENT when 5; then FAILURE when 14; then ABORTED when 15; then INVALID_NAME when 49; then OPERATION_TIMED_OUT else FAILURE end e = klass.allocate e.send(:initialize, msg, errno) e end |
Instance Method Details
#to_s ⇒ Object
43 44 45 |
# File 'lib/mach/error.rb', line 43 def to_s "#{super}: #{error_string(errno)}" end |