Skip to content
  • Lukasa's avatar
    Detect and throw on invalid integer. · 2211dbf3
    Lukasa authored and Nathan Harris's avatar Nathan Harris committed
    Motivation:
    
    parseInteger did not distinguish between not having enough bytes for an
    integer and not being able to parse the integer that was present. This
    was a bit tricky for code internally, where some call sites had extra
    code looking for spooky action at a distance in order to determine if
    the integer failed to parse.
    
    This is unnecessary: parseInteger is sufficiently aware of what's going
    on to address this problem itself.
    
    Modifications:
    
    - Added a new parser error (acceptable as we haven't tagged 1.0 yet).
    - Throw it from parseInteger if the integer is invalid.
    
    Result:
    
    parseInteger clearly communicates if the integer failed to parse.
    2211dbf3