Skip to content

Commit

Permalink
bigint with errors (#208)
Browse files Browse the repository at this point in the history
* bigint with errors

* extra info in message
  • Loading branch information
izulin committed Feb 25, 2020
1 parent ef87c3d commit fd55f4a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/errors.ts
Expand Up @@ -47,9 +47,11 @@ function replacer(key: any, val: any): any {
case 'function':
case 'symbol':
return val.toString()
case 'bigint':
return 'BigInt('+val.toString()+')'
default: {
if(val instanceof RegExp) {
return val.toString()
return 'RegExp('+val.toString()+')'
} else {
return val
}
Expand Down
8 changes: 7 additions & 1 deletion test/unsupported-types.spec.ts
Expand Up @@ -36,7 +36,7 @@ describe( 'unsupported types should result in error', () => {
// eslint-disable-next-line
// @ts-ignore
expect( () => HyperFormula.buildFromArray([[/abcd/]])
).toThrow('Unable to parse value: \"/abcd/\"')
).toThrow('Unable to parse value: \"RegExp(/abcd/)\"')
})
it('should give parsing error #7', () => {
// eslint-disable-next-line
Expand Down Expand Up @@ -66,6 +66,12 @@ describe( 'unsupported types should result in error', () => {
' \"Symbol(/abcd/)\"\n' +
']')
})
it('should give parsing error #11', () => {
// eslint-disable-next-line
// @ts-ignore
expect( () => HyperFormula.buildFromArray([[BigInt(9007199254740991)]])
).toThrow('Unable to parse value: \"BigInt(9007199254740991)\"')
})
it('should give parsing error for setCellContents', () => {
const sheet = [
[],
Expand Down

0 comments on commit fd55f4a

Please sign in to comment.