Sha256: f61ef66b2641bb295250d7aae17ea3493931ef7974ff245826a607f9f7c550d6

Contents?: true

Size: 934 Bytes

Versions: 2

Compression:

Stored size: 934 Bytes

Contents

module Locabulary
  # Container for all exceptions in the Locabulary ecosystem
  module Exceptions
    class RuntimeError < ::RuntimeError
    end

    # There is a problem with the hierarchy; A child is being defined without a defined parent.
    class MissingHierarchicalParentError < RuntimeError
      attr_reader :predicate_name, :error
      def initialize(predicate_name, error)
        @predicate_name = predicate_name
        @error = error
        super("Expected #{predicate_name.inspect} to have a welformed tree. Error: #{error}")
      end
    end

    # There is a problem with the hierarchy; Instead of a tree we have a multitude of trees
    class TooManyHierarchicalRootsError < RuntimeError
      attr_reader :predicate_name, :roots
      def initialize(predicate_name, roots)
        super("Expected fewer root slugs for #{predicate_name.inspect}. Roots encountered: #{roots.inspect}")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
locabulary-0.3.1 lib/locabulary/exceptions.rb
locabulary-0.3.0 lib/locabulary/exceptions.rb