Sha256: e636b0629173f7bba6da982ea3aa282dc451dc1ec38c55238c5b8998070958be

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

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

    # Missing template error
    #
    # This is raised at the runtime when Lotus::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 Lotus::View::Rendering#render
    class MissingFormatError < Error
    end

    # Missing template layout error
    #
    # This is raised at the runtime when Lotus::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

1 entries across 1 versions & 1 rubygems

Version Path
lotus-view-0.5.0 lib/lotus/view/errors.rb