Exception: Idna::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/idna/error.rb

Overview

Source:

https://gitlab.com/libidn/libidn2/-/blob/master/lib/idn2.h.in#L227

Defined Under Namespace

Classes: IDN2_2HYPHEN, IDN2_ALABEL_ROUNDTRIP_FAILED, IDN2_BIDI, IDN2_CONTEXTJ, IDN2_CONTEXTJ_NO_RULE, IDN2_CONTEXTO, IDN2_CONTEXTO_NO_RULE, IDN2_DISALLOWED, IDN2_DOT_IN_LABEL, IDN2_ENCODING_ERROR, IDN2_HYPHEN_STARTEND, IDN2_ICONV_FAIL, IDN2_INVALID_ALABEL, IDN2_INVALID_FLAGS, IDN2_INVALID_NONTRANSITIONAL, IDN2_INVALID_TRANSITIONAL, IDN2_LEADING_COMBINING, IDN2_MALLOC, IDN2_NFC, IDN2_NOT_NFC, IDN2_NO_CODESET, IDN2_OK, IDN2_PUNYCODE_BAD_INPUT, IDN2_PUNYCODE_BIG_OUTPUT, IDN2_PUNYCODE_OVERFLOW, IDN2_TOO_BIG_DOMAIN, IDN2_TOO_BIG_LABEL, IDN2_UALABEL_MISMATCH, IDN2_UNASSIGNED, UNKNOWN

Constant Summary collapse

IDNA_STRINGPREP_ERROR =

V1 mappings, from:

https://gitlab.com/libidn/libidn2/-/blob/master/lib/idn2.h.in#L340

…with some adjustments to match observed behaviour - e.g. “too long” should be “too big domain” or “too big input”, but the above maps it to “string has disallowed character”, which seems to be incorrect (a bug).

Error::IDN2_ENCODING_ERROR
IDNA_PUNYCODE_ERROR =
Error::IDN2_PUNYCODE_BAD_INPUT
IDNA_CONTAINS_NON_LDH =
Error::IDN2_ENCODING_ERROR
IDNA_CONTAINS_LDH =
Error::IDNA_CONTAINS_NON_LDH
IDNA_CONTAINS_MINUS =
Error::IDN2_DISALLOWED
IDNA_INVALID_LENGTH =
Error::IDN2_TOO_BIG_LABEL
IDNA_NO_ACE_PREFIX =
Error::IDN2_ENCODING_ERROR
IDNA_ROUNDTRIP_VERIFY_ERROR =
Error::IDN2_ENCODING_ERROR
IDNA_CONTAINS_ACE_PREFIX =
Error::IDN2_ENCODING_ERROR
IDNA_ICONV_ERROR =
Error::IDN2_ENCODING_ERROR
IDNA_MALLOC_ERROR =
Error::IDN2_MALLOC
IDNA_DLOPEN_ERROR =

Unmappable V1 error classes.

Error::UNKNOWN

Class Method Summary collapse

Class Method Details

.handling(int) ⇒ Object



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
42
43
# File 'lib/idna/error.rb', line 9

def handling(int)
  klass = case int
          when    0 then Idna::Error::IDN2_OK
          when -100 then Idna::Error::IDN2_MALLOC
          when -101 then Idna::Error::IDN2_NO_CODESET
          when -102 then Idna::Error::IDN2_ICONV_FAIL
          when -200 then Idna::Error::IDN2_ENCODING_ERROR
          when -201 then Idna::Error::IDN2_NFC
          when -202 then Idna::Error::IDN2_PUNYCODE_BAD_INPUT
          when -203 then Idna::Error::IDN2_PUNYCODE_BIG_OUTPUT
          when -204 then Idna::Error::IDN2_PUNYCODE_OVERFLOW
          when -205 then Idna::Error::IDN2_TOO_BIG_DOMAIN
          when -206 then Idna::Error::IDN2_TOO_BIG_LABEL
          when -207 then Idna::Error::IDN2_INVALID_ALABEL
          when -208 then Idna::Error::IDN2_UALABEL_MISMATCH
          when -209 then Idna::Error::IDN2_INVALID_FLAGS
          when -300 then Idna::Error::IDN2_NOT_NFC
          when -301 then Idna::Error::IDN2_2HYPHEN
          when -302 then Idna::Error::IDN2_HYPHEN_STARTEND
          when -303 then Idna::Error::IDN2_LEADING_COMBINING
          when -304 then Idna::Error::IDN2_DISALLOWED
          when -305 then Idna::Error::IDN2_CONTEXTJ
          when -306 then Idna::Error::IDN2_CONTEXTJ_NO_RULE
          when -307 then Idna::Error::IDN2_CONTEXTO
          when -308 then Idna::Error::IDN2_CONTEXTO_NO_RULE
          when -309 then Idna::Error::IDN2_UNASSIGNED
          when -310 then Idna::Error::IDN2_BIDI
          when -311 then Idna::Error::IDN2_DOT_IN_LABEL
          when -312 then Idna::Error::IDN2_INVALID_TRANSITIONAL
          when -313 then Idna::Error::IDN2_INVALID_NONTRANSITIONAL
          when -314 then Idna::Error::IDN2_ALABEL_ROUNDTRIP_FAILED
          else           Idna::Error::UNKNOWN
          end
  raise klass.new message(int)
end