peterolson / BigInteger.js

An arbitrary length integer library for Javascript
The Unlicense
1.12k stars 187 forks source link

new Error(...) added to parseStringValue method #138

Closed gslopez closed 6 years ago

gslopez commented 6 years ago

Graphql doesn't work with BigInteger without this change.

peterolson commented 6 years ago

Looks fine to me, but just out of curiosity, why does graphql break if an external library throws an string instead of an error object?

gslopez commented 6 years ago

Thanks !!

I checked the error again, and the problem is that graphql library is using bluebird library for promise management and, I am not sure why, if i throw a String error the application crush without showing the true error location. The log in this case was the following:

(node:92825) Warning: a promise was rejected with a non-error: [object String]
(node:92825) Warning: a promise was rejected with a non-error: [object String]
(node:92825) Warning: a promise was rejected with a non-error: [object String]
{ Error: Invalid integer: 0.00086505000000000000
    at Market.<anonymous> (/Users/username/workspace/projectName/node_modules/graphql-tools/src/schemaGenerator.ts:545:60)
.
.
<More graphql errors>
.
.