Exception: Eaco::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/eaco/error.rb

Overview

An Eaco Runtime Error.

Direct Known Subclasses

Forbidden, Malformed

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ Error

As we make use of heredoc for long error messages, squeeze subsequent spaces and remove newlines. If the message looks like an internal error though, newlines are preserved.

Example:

raise Eaco::Error, <<-EOF
  Some fancy message
end

Parameters:

  • message (String)

19
20
21
22
23
24
25
# File 'lib/eaco/error.rb', line 19

def initialize(message)
  unless message =~ %r{EACO.+Error}
    message = message.squeeze(' ').gsub("\n", '')
  end

  super message
end