Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Digit sequence has wrong length

Scott Smith edited this page Mar 16, 2018 · 2 revisions

The fully-formatted error message

The digits for the 'year', '199', has the wrong length: '3'.

          199-05-29?12:25:12.1-01:00 
          ^^^

A 'year' requires 4 digits.

Substitutions

Name Value Type Source
Input 199-05-29?12:25:12.1-01:00 String The ISO8601 string being parsed
Expected 4 Int What the parse command is looking for
Actual 3 Int What the parse found
PreviousName Nothing Nothing In this example, the error field is the first one
PreviousValue Nothing Nothing The value of the immediately preceding field
PreviousType Nothing Nothing "digits" or "delimiter"
PreviousStartOffset 1 Int The displacement from the start of the string being parsed to locate the leftmost '^'
PreviousCharCount 3 Int The number of '^' chars to position under the previous value
TopLine "The ? for the '?', '?', has the wrong length: '?':" String This error category
BottomLine "A '?' requires ? digits." String This error category

Notes

  1. The Value column above describes the example values in the sample error message above.
  2. The offset of the actual error position is calculated: it is always after the sum of the PreviousStartOffset and the PreviousCharCount.
  3. Here's an example where the number of 'X' is zero. Conflicts with Required delimiter is missing.
  4. Note that TopLine and BottomLine have '?' marking where values will be substituted.
  5. I'm wondering if the type of the preceding field can be automatically derived.