Skip to content

Commit abb75ea

Browse files
andrew-colemanmattbaileyuk
authored andcommitted
check for unsupported sequence in parseInteger
Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
1 parent 0428342 commit abb75ea

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/datetime.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,12 @@ const dateTime = (function () {
10301030
}
10311031
return parseInt(digits);
10321032
};
1033+
break;
1034+
case formats.SEQUENCE:
1035+
throw {
1036+
code: 'D3130',
1037+
value: formatSpec.token
1038+
};
10331039
}
10341040

10351041
}

src/jsonata.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1970,7 +1970,7 @@ var jsonata = (function() {
19701970
"D3110": "The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}",
19711971
"D3120": "Syntax error in expression passed to function eval: {{value}}",
19721972
"D3121": "Dynamic error evaluating the expression passed to function eval: {{value}}",
1973-
"D3130": "Formatting an integer as a sequence starting with {{value}} is not supported by this implementation",
1973+
"D3130": "Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation",
19741974
"D3131": "In a decimal digit pattern, all digits must be from the same decimal group",
19751975
"D3132": "Unknown component specifier {{value}} in date/time picture string",
19761976
"D3133": "The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}",

test/test-suite/groups/function-parseInteger/parseInteger.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,5 +478,13 @@
478478
"expr": "$parseInteger('FZPH', 'A')",
479479
"data": {},
480480
"result": 123456
481+
},
482+
{
483+
"function": "#parseInteger",
484+
"category": "errors",
485+
"description": "unsupported picture string",
486+
"expr": "$parseInteger('50', '#')",
487+
"data": {},
488+
"code": "D3130"
481489
}
482490
]

0 commit comments

Comments
 (0)