Sha256: 6f6d16a389a185fa8dfdebab482bce122533830d7a28db17f5cd68b8491a4e1e

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module WCC::Contentful
  class SyncError < StandardError
  end

  # Raised when a constant under {WCC::Contentful::Model} does not match to a
  # content type in the configured Contentful space
  class ContentTypeNotFoundError < NameError
  end

  # Raised when an entry contains a circular reference and cannot be represented
  # as a flat tree.
  class CircularReferenceError < StandardError
    attr_reader :stack, :id

    def initialize(stack, id)
      @id = id
      @stack = stack.slice(stack.index(id)..stack.length)
      super('Circular reference detected!')
    end

    def message
      return super unless stack

      super + "\n  " \
              "#{stack.last} points to #{id} which is also it's ancestor\n  " +
        stack.join('->')
    end
  end

  # Raised by {WCC::Contentful::ModelMethods#resolve Model#resolve} when attempting
  # to resolve an entry's links and that entry cannot be found in the space.
  class ResolveError < StandardError
  end

  class InitializationError < StandardError
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wcc-contentful-1.3.2 lib/wcc/contentful/exceptions.rb
wcc-contentful-1.3.1 lib/wcc/contentful/exceptions.rb
wcc-contentful-1.3.0 lib/wcc/contentful/exceptions.rb
wcc-contentful-1.2.1 lib/wcc/contentful/exceptions.rb