Sha256: 0dcaa0cfe03e29c48c718788242c505e118280e62b8e2e07e5e7c2795605272d

Contents?: true

Size: 1.07 KB

Versions: 7

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module Hanami
  class View
    # Base error for views.
    #
    # @since 2.1.0
    # @api public
    class Error < StandardError
    end

    # Error raised when critical settings are not configured.
    #
    # @api public
    # @since 2.1.0
    class UndefinedConfigError < StandardError
      def initialize(key)
        super("no +#{key}+ configured")
      end
    end

    # Error raised when template could not be found within a view's configured paths.
    #
    # @api public
    # @since 2.1.0
    class TemplateNotFoundError < StandardError
      def initialize(template_name, format, lookup_paths)
        msg = [
          "Template `#{template_name}' for format `#{format}' could not be found in paths:",
          lookup_paths.map { |path| " - #{path}" }
        ].join("\n\n")

        super(msg)
      end
    end

    # Error raised when a rendering is required but not given.
    #
    # @api public
    # @since 2.1.0
    class RenderingMissingError < Error
      def message
        "a +rendering+ must be provided"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hanami-view-2.2.0 lib/hanami/view/errors.rb
hanami-view-2.2.0.rc1 lib/hanami/view/errors.rb
hanami-view-2.2.0.beta2 lib/hanami/view/errors.rb
hanami-view-2.2.0.beta1 lib/hanami/view/errors.rb
hanami-view-2.1.0 lib/hanami/view/errors.rb
hanami-view-2.1.0.rc3 lib/hanami/view/errors.rb
hanami-view-2.1.0.rc2 lib/hanami/view/errors.rb