Exception: SparkleFormation::Error::NotFound

Inherits:
KeyError
  • Object
show all
Defined in:
lib/sparkle_formation/error.rb

Overview

File not found error

Direct Known Subclasses

Component, Dynamic, Registry, Resource, Template

Defined Under Namespace

Classes: Component, Dynamic, Registry, Resource, Template

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ NotFound

Returns a new instance of NotFound



18
19
20
21
22
23
# File 'lib/sparkle_formation/error.rb', line 18

def initialize(*args)
  opts = args.detect { |o| o.is_a?(Hash) }
  args.delete(opts) if opts
  super(args)
  @name = opts[:name] if opts
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name



16
17
18
# File 'lib/sparkle_formation/error.rb', line 16

def name
  @name
end

Instance Method Details

#to_sString

Returns customized message including name

Returns:

  • (String)

    customized message including name



26
27
28
29
30
31
32
# File 'lib/sparkle_formation/error.rb', line 26

def to_s
  if name
    "Failed to locate item named: `#{name}`"
  else
    "Failed to locate item"
  end
end