Sha256: f4529d00a18c8cd87540d5ae8c21411b0ee7034fad59a7a4b822740700948fea

Contents?: true

Size: 1.4 KB

Versions: 12

Compression:

Stored size: 1.4 KB

Contents

module Protobuf
  module ActiveRecord
    # = Protobuf Active Record errors
    #
    # Generic Protobuf Active Record exception class
    class ProtobufActiveRecordError < StandardError
    end

    # Raised by `attribute_from_proto` when the transformer method
    # given is not callable.
    class AttributeTransformerError < ProtobufActiveRecordError
      def message
        "Attribute transformers must be called with a callable or block!"
      end
    end

    # Raised by `field_from_record` when the convert method
    # given not callable.
    class FieldTransformerError < ProtobufActiveRecordError
      def message
        "Field transformers must be called with a callable or block!"
      end
    end

    # Raised by `to_proto` when no protobuf message is defined.
    class MessageNotDefined < ProtobufActiveRecordError
      attr_reader :class_name

      def initialize(klass)
        @class_name = klass.name
      end

      def message
        "#{class_name} does not define a protobuf message"
      end
    end

    # Raised by `field_scope` when given scope is not defined.
    class SearchScopeError < ProtobufActiveRecordError
    end

    # Raised by `upsert_scope` when a given scope is not defined
    class UpsertScopeError < ProtobufActiveRecordError
    end

    # Raised by `for_upsert` when no valid upsert_scopes are found
    class UpsertNotFoundError < ProtobufActiveRecordError
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
protobuf-activerecord-7.0.0 lib/protobuf/active_record/errors.rb
protobuf-activerecord-6.1.0 lib/protobuf/active_record/errors.rb
protobuf-activerecord-6.0.0 lib/protobuf/active_record/errors.rb
protobuf-activerecord-5.2.0 lib/protobuf/active_record/errors.rb
protobuf-activerecord-5.1.0 lib/protobuf/active_record/errors.rb
protobuf-activerecord-5.0.0 lib/protobuf/active_record/errors.rb
protobuf-activerecord-5.1.0.beta lib/protobuf/active_record/errors.rb
protobuf-activerecord-5.0.0.beta lib/protobuf/active_record/errors.rb
protobuf-activerecord-3.6.1 lib/protobuf/active_record/errors.rb
protobuf-activerecord-3.6.0 lib/protobuf/active_record/errors.rb
protobuf-activerecord-3.5.1 lib/protobuf/active_record/errors.rb
protobuf-activerecord-3.5.0 lib/protobuf/active_record/errors.rb