Skip to content

Conversation

jpage-godaddy
Copy link

@jpage-godaddy jpage-godaddy commented Jun 4, 2025

DOMException instances have getters that require correct 'this' context. Hoek.clone() creates copies that lose the internal structure needed for these getters to work, causing "Value of 'this' must be of DOMException" errors. Extract message and name properties before cloning to avoid this issue.

Example stack trace error we were getting:

TypeError: Value of "this" must be of DOMException
    at throwInvalidThisError (node:internal/per_context/domexception:17:15)
    at get message [as message] (node:internal/per_context/domexception:90:7)
    at internals.initialize (/.../@hapi/boom/lib/index.js:427:14)
    at exports.boomify (/.../@hapi/boom/lib/index.js:126:26)
    at new exports.Boom (/.../@hapi/boom/lib/index.js:74:28)
    at internals.serverError (/.../@hapi/boom/lib/index.js:468:12)
    at exports.badImplementation (/.../@hapi/boom/lib/index.js:400:27)
    at ...
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_INVALID_THIS'
}

DOMException instances have getters that require correct 'this' context.
Hoek.clone() creates copies that lose the internal structure needed for
these getters to work, causing "Value of 'this' must be of DOMException"
errors. Extract message and name properties before cloning to avoid this issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant