Sha256: 26011892bb2a9b1744dcbf4f8aa91a519f17a1aa9265ce2032ce44c4ff484b85

Contents?: true

Size: 1.71 KB

Versions: 90

Compression:

Stored size: 1.71 KB

Contents

# frozen_string_literal: true

class Nanoc::DataSources::Filesystem < Nanoc::DataSource
  # @api private
  module Errors
    class Generic < ::Nanoc::Error
    end

    class BinaryLayout < Generic
      def initialize(content_filename)
        super("The layout file '#{content_filename}' is a binary file, but layouts can only be textual")
      end
    end

    class MultipleMetaFiles < Generic
      def initialize(meta_filenames, basename)
        super("Found #{meta_filenames.size} meta files for #{basename}; expected 0 or 1")
      end
    end

    class MultipleContentFiles < Generic
      def initialize(content_filenames, basename)
        super("Found #{content_filenames.size} content files for #{basename}; expected 0 or 1")
      end
    end

    class InvalidFormat < Generic
      def initialize(content_filename)
        super("The file '#{content_filename}' appears to start with a metadata section (three or five dashes at the top) but it does not seem to be in the correct format.")
      end
    end

    class UnparseableMetadata < Generic
      def initialize(filename, error)
        super("Could not parse metadata for #{filename}: #{error.message}")
      end
    end

    class InvalidMetadata < Generic
      def initialize(filename, klass)
        super("The file #{filename} has invalid metadata (expected key-value pairs, found #{klass} instead)")
      end
    end

    class InvalidEncoding < Generic
      def initialize(filename, encoding)
        super("Could not read #{filename} because the file is not valid #{encoding}.")
      end
    end

    class FileUnreadable < Generic
      def initialize(filename, error)
        super("Could not read #{filename}: #{error.inspect}")
      end
    end
  end
end

Version data entries

90 entries across 90 versions & 1 rubygems

Version Path
nanoc-4.13.3 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.13.2 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.13.1 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.13.0 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.21 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.20 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.19 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.18 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.17 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.16 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.15 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.14 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.13 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.12 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.11 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.10 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.9 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.8 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.7 lib/nanoc/data_sources/filesystem/errors.rb
nanoc-4.12.6 lib/nanoc/data_sources/filesystem/errors.rb