Sha256: 9e6c1eb2145d537e191d3868a173641f9e04e390000bc633b2ea1e7692c56be9

Contents?: true

Size: 1.54 KB

Versions: 6

Compression:

Stored size: 1.54 KB

Contents

module Render
  module Errors
    class InvalidType < StandardError
      attr_accessor :name

      def initialize(name)
        self.name = name
      end

      def to_s
        "Cannot parse type: #{name}."
      end
    end

    class Generator
      class MalformedAlgorithm < StandardError
        attr_accessor :algorithm

        def initialize(algorithm)
          self.algorithm = algorithm
        end

        def to_s
          "Algorithms must respond to #call, which #{algorithm.inspect} does not."
        end
      end
    end

    class Graph
      class EndpointKeyNotFound < StandardError
        attr_accessor :config_key

        def initialize(config_key)
          self.config_key = config_key
        end

        def to_s
          "No value for key #{config_key} found in config or parental_properties."
        end
      end
    end

    class DefinitionNotFound < StandardError
      attr_accessor :title

      def initialize(title)
        self.title = title
      end

      def to_s
        "Schema with title #{title} is not loaded"
      end
    end

    class Schema
      class RequestError < StandardError
        attr_accessor :endpoint, :response

        def initialize(endpoint, response)
          self.endpoint = endpoint
          self.response = response
        end

        def to_s
          "Could not reach #{endpoint} because #{response}."
        end
      end

      class InvalidResponse < RequestError
        def to_s
          "Could not parse #{response.inspect} from #{endpoint}"
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
render-0.0.8 lib/render/errors.rb
render-0.0.7 lib/render/errors.rb
render-0.0.6 lib/render/errors.rb
render-0.0.5 lib/render/errors.rb
render-0.0.4 lib/render/errors.rb
render-0.0.3 lib/render/errors.rb