@nevermined-io/payments
    Preparing search index...

    Function safeParseJson

    • Safe JSON parse for fetch responses. Reads the body once and tolerates non-JSON payloads (e.g. NGINX HTML 5xx gateway pages) by returning a { message } shell that downstream error code paths can still consume.

      Prevents the failure mode tracked in #1727: callers doing throw PaymentsError.fromBackend('...', await response.json()) would otherwise let a SyntaxError from .json() escape and surface as an unhandledRejection that can take the host Node process down.

      Parameters

      • response: Response

      Returns Promise<unknown>