bitovi / querystring-parser

MIT License
8 stars 5 forks source link

Errors getting swallowed #79

Closed claytongulick closed 6 months ago

claytongulick commented 8 months ago

In line 18 of parse.js:

const filterResult = parseFilters(filter, queryErrors?.filter);

the call to parseFilters is swallowing the errors. If a filter error occurred, line 89 of parseFilters swallows it:

if (filters) {
    if (filtersError.length) {
      errors = filtersError;
    } else if (!isObject(filters)) {
...

filters, in this case is undefined so the errors don't get reported back to the calling function.

The end result is when calling this:

let parsed = parser.parse(string);

If there is an error, the result is an empty data field and an empty errors array.

justinbmeyer commented 8 months ago

seems like a bug to me

nlundquist commented 8 months ago

Thanks for the bug report Clayton. Yeah, it looks like that check for filtersError should be moved up / out of this block.

We'll get a fix out for that shortly.