Sha256: 5be5bc52c0baf78849387576a5767e6245662308f77cb97108b88b5382e8bc03

Contents?: true

Size: 978 Bytes

Versions: 16

Compression:

Stored size: 978 Bytes

Contents

require 'sparkle_formation'

class SparkleFormation

  # SparkleFormation specific errors
  class Error < StandardError

    # Inheritance error
    class CircularInheritance < Error; end

    # File not found error
    class NotFound < KeyError
      attr_reader :name

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

      # @return [String] customized message including name
      def to_s
        if(name)
          "Failed to locate item named: `#{name}`"
        else
          'Failed to locate item'
        end
      end

      # Pack related items
      class Dynamic < NotFound; end
      class Component < NotFound; end
      class Registry < NotFound; end
      class Template < NotFound; end

      # Template internals
      class Resource < NotFound; end

    end

    # Deprecation error
    class Deprecated < Error; end

  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
sparkle_formation-3.0.20 lib/sparkle_formation/error.rb
sparkle_formation-3.0.18 lib/sparkle_formation/error.rb
sparkle_formation-3.0.16 lib/sparkle_formation/error.rb
sparkle_formation-3.0.14 lib/sparkle_formation/error.rb
sparkle_formation-3.0.12 lib/sparkle_formation/error.rb
sparkle_formation-3.0.10 lib/sparkle_formation/error.rb
sparkle_formation-3.0.8 lib/sparkle_formation/error.rb
sparkle_formation-3.0.6 lib/sparkle_formation/error.rb
sparkle_formation-3.0.4 lib/sparkle_formation/error.rb
sparkle_formation-3.0.2 lib/sparkle_formation/error.rb
sparkle_formation-3.0.0 lib/sparkle_formation/error.rb
sparkle_formation-2.1.8 lib/sparkle_formation/error.rb
sparkle_formation-2.1.6 lib/sparkle_formation/error.rb
sparkle_formation-2.1.4 lib/sparkle_formation/error.rb
sparkle_formation-2.1.2 lib/sparkle_formation/error.rb
sparkle_formation-2.1.0 lib/sparkle_formation/error.rb