Sha256: b3511ecf27fb4fc8445bb56a12d7c2314d9f14d07fa3a29b7d9fa07bfd03dca5

Contents?: true

Size: 1.34 KB

Versions: 5

Compression:

Stored size: 1.34 KB

Contents

module Hanami
  module View
    # @since 0.5.0
    class Error < ::StandardError
    end

    # Missing template error
    #
    # This is raised at the runtime when Hanami::View cannot find a template for
    # the requested format.
    #
    # We can't raise this error during the loading phase, because at that time
    # we don't know if a view implements its own rendering policy.
    # A view is allowed to override `#render`, and this scenario can make the
    # presence of a template useless. One typical example is the usage of a
    # serializer that returns the output string, without rendering a template.
    #
    # @since 0.1.0
    class MissingTemplateError < Error
      def initialize(template, format)
        super("Can't find template '#{ template }' for '#{ format }' format.")
      end
    end

    # Missing format error
    #
    # This is raised at the runtime when rendering context lacks of the :format
    # key.
    #
    # @since 0.1.0
    #
    # @see Hanami::View::Rendering#render
    class MissingFormatError < Error
    end

    # Missing template layout error
    #
    # This is raised at the runtime when Hanami::Layout cannot find it's template.
    #
    # @since 0.5.0
    class MissingTemplateLayoutError < Error
      def initialize(template)
        super("Can't find layout template '#{ template }'")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hanami-view-1.0.0.beta1 lib/hanami/view/errors.rb
hanami-view-0.8.0 lib/hanami/view/errors.rb
hanami-view-0.7.0 lib/hanami/view/errors.rb
hanami-view-0.6.1 lib/hanami/view/errors.rb
hanami-view-0.6.0 lib/hanami/view/errors.rb