CoerceFloat throwing error instead of parsing string to float from json
See original GitHub issueHi i notice that recently i started getting this error TypeError: Float cannot represent non numeric value: “234234234” at GraphQLScalarType.coerceFloat [as parseValue] i have another api that works fine when i started looking at the problem i realize that graphql was a different version where in version 14.1.1 coerceFloat is
function`` coerceFloat(value) {
if (!(0, _isFinite.default)(value)) {
throw new TypeError("Float cannot represent non numeric value: ".concat((0, _inspect.default)(value)));
}
return value;
}
in version 0.13.2 coerceFloat is
function` coerceFloat(value) {
if (value === '') {
throw new TypeError('Float cannot represent non numeric value: (empty string)');
}
var num = Number(value);
if (num === num) {
return num;
}
throw new TypeError('Float cannot represent non numeric value: ' + String(value));
}
when i copy paste second one in first one in scalar.js it just works fine
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
It's not possible to convert a string from JsonObject to float in ...
I am using the 'Socket.IO for Unity' plugin and sending data to the server using JSONObject, but ...
Read more >The Basics - Simdjson
The simdjson library relies on an approach to parsing JSON that we call "On Demand". A document is not a fully-parsed JSON value;...
Read more >How to parse a JSON with Python? - ReqBin
The Python JSON Parser library does not throw duplicate key exceptions. It ignores duplicate key-value pairs and takes the last key-value pair.
Read more >Bloblang Methods - Benthos
Split a string value into an array of strings by splitting it on a string ... of an integer or contains decimal values...
Read more >SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
The JavaScript exceptions thrown by JSON.parse() occur when string failed to be ... Instead write just 1 without a zero and use at...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@ivanGoncharov Thanks for building things like this for us
@BePasquet Yes, moreover it’s always a good idea to validate on fe. GraphQL validation is intended to assist with debugging during development that’s why error messages are not user-friendly and don’t support for internationalization.