Exception: SystemCallError

Inherits:
Exception
  • Object
show all
Defined in:
lib/ugh.rb

Instance Method Summary collapse

Instance Method Details

#strerrorObject



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/ugh.rb', line 77

def strerror
  # Remove in-sentence bits of context such as filename(s)
  # by looking up the error message without context:
  m = SystemCallError.new(errno).message

  # Fix message case by downcasing the initial uppercase
  # letter except if it's immediately followed by another
  # uppercase letter, as in [["RPC version wrong"]]:
  m = m.sub(/\A[[:upper:]](?![[:upper:]])/){$&.downcase}

  return m
end