File: failed_string_prep_validation.rb

package info (click to toggle)
ruby-mongo 2.21.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 14,764 kB
  • sloc: ruby: 108,806; makefile: 5; sh: 2
file content (41 lines) | stat: -rw-r--r-- 1,307 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true
# rubocop:todo all

module Mongo
  class Error
    # This exception is raised when stringprep validation fails, such as due to
    #   character being present or bidirection data being invalid.
    #
    # @since 2.6.0
    class FailedStringPrepValidation < Error
      # The error message describing failed bidi validation.
      #
      # @since 2.6.0
      INVALID_BIDIRECTIONAL = 'Data failed bidirectional validation'.freeze

      # The error message describing the discovery of a prohibited character.
      #
      # @since 2.6.0
      PROHIBITED_CHARACTER = 'Data contains a prohibited character.'.freeze

      # The error message describing that stringprep normalization can't be done on Ruby versions
      # below 2.2.0.
      #
      # @since 2.6.0
      UNABLE_TO_NORMALIZE = 'Unable to perform normalization with Ruby versions below 2.2.0'.freeze

      # Create the new exception.
      #
      # @example Create the new exception.
      #   Mongo::Error::FailedStringPrepValidation.new(
      #     Mongo::Error::FailedStringPrepValidation::PROHIBITED_CHARACTER)
      #
      # @param [ String ] msg The error message describing how the validation failed.
      #
      # @since 2.6.0
      def initialize(msg)
        super(msg)
      end
    end
  end
end