Sha256: 44cfebcfc9eb204049d4afcda327dc07453b5f43d242147b5337fea7aa7e7e9e

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module Hanami
  class View
    # @since 2.0.0
    # @api public
    class Error < StandardError
    end

    # Error raised when critical settings are not configured
    #
    # @api private
    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 private
    class TemplateNotFoundError < StandardError
      def initialize(template_name, lookup_paths)
        msg = [
          "Template +#{template_name}+ could not be found in paths:",
          lookup_paths.map { |path| " - #{path}" }
        ].join("\n\n")

        super(msg)
      end
    end

    # Error raised when layout could not be found within a view's configured
    # paths
    #
    # @api private
    class LayoutNotFoundError < StandardError
      def initialize(layout_name, lookup_paths)
        msg = [
          "Layout +#{layout_name}+ could not be found in paths:",
          lookup_paths.map { |path| " - #{path}" }
        ].join("\n\n")

        super(msg)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hanami-view-2.0.0.alpha8 lib/hanami/view/errors.rb