MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / #error

Method #error

examples/io/tcp/httpclient/httpclient.js:423–446  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

421 } while (this.#pendingWrite && this.#writable);
422 }
423 #error(e) {
424 if (("receivedBody" === this.#state) && this.#timer) { // completion not reported yet. report before handling error.
425 Timer.clear(this.#timer);
426 this.#done();
427 }
428
429 this.#state = "error";
430
431 try {
432 const current = this.#current;
433 this.#current = undefined;
434 current?.onDone?.call(current.request, new Error);
435
436 while (this.#requests.length) {
437 const request = this.#requests.shift();
438 request.onDone?.call(request.request, new Error);
439 }
440 this.#onError?.(e);
441 }
442 catch {
443 /* this space intentionally left blank */
444 }
445 this.close();
446 }
447 #done() {
448 this.#timer = undefined;
449

Callers 2

constructorMethod · 0.95
#onReadableMethod · 0.95

Calls 4

#doneMethod · 0.95
closeMethod · 0.95
clearMethod · 0.45
#onErrorMethod · 0.45

Tested by

no test coverage detected