Skip to content

Commit 74e786b

Browse files
author
George Blue
committed
Write out token value, not internal type
1 parent 20e0494 commit 74e786b

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

jsonata.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ var jsonata = (function() {
685685
var err = {
686686
code: code,
687687
position: node.position,
688-
token: node.id,
688+
token: node.value,
689689
value: id
690690
};
691691
return handleError(err);

test/jsonata-test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5873,6 +5873,15 @@ describe('Evaluator - errors', function () {
58735873
});
58745874
});
58755875

5876+
describe('$replace("foo", "o, "rr")', function () {
5877+
it('should throw error', function () {
5878+
expect(function () {
5879+
jsonata('$replace("foo", "o, "rr")');
5880+
}).to.throw()
5881+
.to.deep.contain({position: 24, code: 'S0202', token: 'rr"', value: ')'});
5882+
});
5883+
});
5884+
58765885
describe('[1!2]', function () {
58775886
it('should throw error', function () {
58785887
expect(function () {

test/parser-recovery.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ describe('Invoke parser with incomplete expression', function() {
170170
{
171171
"code": "S0202",
172172
"position": 16,
173-
"token": "(literal)",
173+
"token": "0",
174174
"value": "]",
175175
"remaining": [
176176
{

0 commit comments

Comments
 (0)