Sha256: 84da5f631b5c5602842af559fe8bcbee8510b04c95a6337859dd50d572d3264a

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

require "sparkle_formation"

class SparkleFormation

  # SparkleFormation specific errors
  class Error < StandardError

    # Inheritance error
    class CircularInheritance < Error; end

    # Found resource improperly constructed
    class InvalidResource < 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

5 entries across 5 versions & 1 rubygems

Version Path
sparkle_formation-3.0.40 lib/sparkle_formation/error.rb
sparkle_formation-3.0.38 lib/sparkle_formation/error.rb
sparkle_formation-3.0.36 lib/sparkle_formation/error.rb
sparkle_formation-3.0.34 lib/sparkle_formation/error.rb
sparkle_formation-3.0.32 lib/sparkle_formation/error.rb