Sha256: a92697c03ea7c7bc5f05572dc1aff0b0cbf80641066c00c7d014c76c6cb9461c

Contents?: true

Size: 929 Bytes

Versions: 1

Compression:

Stored size: 929 Bytes

Contents

# frozen_string_literal: true

module RASN1
  # Base error class
  class Error < StandardError; end

  # ASN.1 encoding/decoding error
  class ASN1Error < Error; end

  # ASN.1 class error
  class ClassError < Error
    # @return [String]
    def message
      "Tag class should be a symbol among: #{Types::Base::CLASSES.keys.join(', ')}"
    end
  end

  # Enumerated error
  class EnumeratedError < Error; end

  # CHOICE error: #chosen not set
  class ChoiceError < RASN1::Error
    def message
      "CHOICE #{@name}: #chosen not set"
    end
  end

  # Exception raised when a constraint is not verified on a constrained type.
  # @version 0.11.0
  # @author Sylvain Daubert
  class ConstraintError < Error
    # @param [Types::Base] object
    def initialize(object)
      @object = object
      super()
    end

    # @return [String]
    def message
      "Constraint not verified on #{object.inspect}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rasn1-0.11.0 lib/rasn1/errors.rb