@calimero-network/mero-js 21.2.0 → 21.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,7 +41,12 @@ function extractErrorMessage(bodyText) {
41
41
  // Custom error class for HTTP errors
42
42
  export class HTTPError extends Error {
43
43
  constructor(status, statusText, url, headers, bodyText) {
44
- const explanation = extractErrorMessage(bodyText);
44
+ // Status 0 means no response arrived: every client puts the thrown error's
45
+ // message in `bodyText`, as plain text. It is the only explanation there is
46
+ // — "The node refused to attest: HTTP 404" from a sealed fetch, or
47
+ // "This operation was aborted" from a timeout — so report it as is.
48
+ const explanation = extractErrorMessage(bodyText) ??
49
+ (status === 0 && bodyText?.trim() ? bodyText.trim() : undefined);
45
50
  super(explanation
46
51
  ? `HTTP ${status} ${statusText}: ${explanation}`
47
52
  : `HTTP ${status} ${statusText}`);