MCPcopy Create free account
hub / github.com/nodejs/node / replyWithError

Method replyWithError

deps/undici/src/lib/mock/mock-interceptor.js:166–173  ·  view source on GitHub ↗

* Mock an undici request with a defined error.

(error)

Source from the content-addressed store, hash-verified

164 * Mock an undici request with a defined error.
165 */
166 replyWithError (error) {
167 if (typeof error === 'undefined') {
168 throw new InvalidArgumentError('error must be defined')
169 }
170
171 const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], { error }, { ignoreTrailingSlash: this[kIgnoreTrailingSlash] })
172 return new MockScope(newMockDispatch)
173 }
174
175 /**
176 * Set default reply headers on the interceptor for subsequent replies

Callers 1

doctor.jsFile · 0.80

Calls 1

addMockDispatchFunction · 0.85

Tested by

no test coverage detected