-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hoek.clone drop an error with axios errors in version @hapi/hoek 11.0.6+ #400
Comments
I don't think it's generally safe to do this on errors. You should either create your own custom error class, like so: class CustomError extends AxiosError {
foo() {}
}
const err = new CustomError('error'); Or add it as non-enumerable: const error = new AxiosError('error');
Object.defineProperty(error, 'fun', { value: () => {}, enumerable: false }); |
@Marsup I tend to agree, but Hoek should never throw an error when cloning. Something strange is going on here. I am unable to replicate the issue with regular errors, only |
Doesn't it then become axios's problem? |
Fix is released in 11.0.7, thanks @kanongil for the patch 🙏🏻 |
Thanks :) |
Runtime
node.js
Runtime version
20.17
Module version
11.0.6
Last module version without issue
11.0.4
Used with
No response
Any other relevant information
Function
structuredClone
drop an error, if clonning object has functions https://github.com/hapijs/hoek/blob/v11.0.6/lib/clone.js#L177What are you trying to achieve or the steps to reproduce?
What was the result you got?
Got an error like:
node:internal/per_context/domexception:53 ErrorCaptureStackTrace(this); ^ DOMException [DataCloneError]: function httpAdapter(config) { return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise)...<omitted>... } could not be cloned.
What result did you expect?
Haven't gotten this error on previous version of lib
The text was updated successfully, but these errors were encountered: