Sha256: 32c7a3394e1d2df332b33845f7b2a07345a8b854af72f6bfb8a030e1b87d5813

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 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

    # @since 2.0.0
    # @api public
    class MissingProviderError < Error
      def initialize(provider)
        super("#{provider.inspect} is missing")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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