MCPcopy
hub / github.com/lissy93/web-check / wrapNetworkError

Function wrapNetworkError

api/_common/http.js:49–62  ·  view source on GitHub ↗
(error)

Source from the content-addressed store, hash-verified

47const isOk = (status, validate) => (validate ? validate(status) : status >= 200 && status < 300);
48
49const wrapNetworkError = (error) => {
50 if (error.name === 'TimeoutError' || error.name === 'AbortError') {
51 const e = new Error(error.message || 'Request timed out');
52 e.code = 'ECONNABORTED';
53 return e;
54 }
55 const code = error.cause?.code;
56 if (code) {
57 const e = new Error(error.message);
58 e.code = code;
59 return e;
60 }
61 return error;
62};
63
64const UA = 'web-check/1.0 (https://web-check.xyz)';
65

Callers 1

sendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected