Sha256: 94f880622a1183adf813aab1541916a927d7a172182002133ba4f33f28b37f86

Contents?: true

Size: 1019 Bytes

Versions: 6

Compression:

Stored size: 1019 Bytes

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
    attr_reader :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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wcc-contentful-0.4.0.pre.rc lib/wcc/contentful/exceptions.rb
wcc-contentful-0.4.0.pre.beta lib/wcc/contentful/exceptions.rb
wcc-contentful-0.4.0.pre.alpha lib/wcc/contentful/exceptions.rb
wcc-contentful-0.3.0.pre.rc3 lib/wcc/contentful/exceptions.rb
wcc-contentful-0.3.0.pre.rc2 lib/wcc/contentful/exceptions.rb
wcc-contentful-0.3.0.pre.rc lib/wcc/contentful/exceptions.rb