You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[dove][package error] Creating an error with a null err breaks #2789
consterr=newBadRequest(null,data)// this will equivalent toconsterr=FeathersError(null,'BadRequest',400,'bad-request',data);
err will be like
{type: 'FeathersError',name: 'BadRequest',message: 'Error',// by default, with null value in first param, the "Error" string is setcode: 400,className: 'bad-request',
...
}
In dove implementation, with the same call - the BadRequest one,
this will break at #L35 as typeof null === 'object' is true.
Code will try to destructure null in { message, errors, ...rest }.
Another interesting thing is that constructor of errors like, eg, BadRequest takes 2 optional params message?: ErrorMessage, data?: any, but the FeathersError constructor want mandatory params : err and _data aren't optional.
This use case allow feathers-authentication-management to still create BadRequest errors with an errnull.
Is this use case still accepted ?
Could we fix the previous implementation ?
I fix temporary the package by updating the #L36 :
If needed, I can submit a PR with fix on typing (FeathersError constructor with err: ErrorMessage | null) and tests proving new BadRequest(null, ...) work.
Activity
daffl commentedon Oct 12, 2022
Thanks for the detailed error report. This should be fixed via #2776
mdartic commentedon Oct 12, 2022
Thanks !