parse_error

Types

pub type ParseError {
  InvalidCharacter(character: String, index: Int)
  EmptyString
  WhitespaceOnlyString
  InvalidUnderscorePosition(index: Int)
  InvalidDecimalPosition(index: Int)
  InvalidSignPosition(character: String, index: Int)
  GleamFloatParseError
  GleamIntParseError
}

Constructors

  • InvalidCharacter(character: String, index: Int)

    Represents an error when an invalid character is encountered during parsing.

    • character: The invalid character as a String.
    • index: The position of the invalid character in the input string.
  • EmptyString

    Represents an error when the input string is empty.

  • WhitespaceOnlyString

    Represents an error when the input string contains only whitespace characters.

  • InvalidUnderscorePosition(index: Int)

    Represents an error when an underscore is in an invalid position within the number string.

    • index: The position of the invalid underscore in the input string.
  • InvalidDecimalPosition(index: Int)

    Represents an error when a decimal point is in an invalid position within the number string.

    • index: The position of the invalid decimal point in the input string.
  • InvalidSignPosition(character: String, index: Int)

    Represents an error when a sign (+ or -) is in an invalid position within the number string.

    • character: The sign character that caused the error as a String.
    • index: The position of the invalid sign in the input string.
  • GleamFloatParseError

    Represents an error when Gleam’s float.parse fails after custom parsing and coercion.

    This indicates that the string couldn’t be converted to a float even with more permissive rules.

  • GleamIntParseError

    Represents an error when Gleam’s int.parse fails after custom parsing and coercion.

    This indicates that the string couldn’t be converted to an integer even with more permissive rules.

Search Document