Exception: Jekyll::Diagrams::Errors::BasicError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/jekyll-diagrams/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(val) ⇒ BasicError

Returns a new instance of BasicError.



7
8
9
10
11
12
13
14
15
# File 'lib/jekyll-diagrams/errors.rb', line 7

def initialize(val)
  # Jekyll::...::CommandNotFoundError -> 'CommandNotFoundError'
  klass = self.class.name.split('::').last
  # 'CommandNotFound' -> 'Command Not Found'
  prefix = klass.sub(/Error$/, '').split(/(?=[A-Z])/).join(' ')

  # "Command Not Found: raw message"
  super("#{prefix}: #{val}")
end