@grabjs/superapp-sdk
    Preparing search index...

    Function isErrorResponse

    • Type guard to check if a JSBridge response is an error (4xx or 5xx status codes).

      Type Parameters

      • T

      Parameters

      Returns response is BridgeError

      True if the response is any error (4xx or 5xx), false otherwise

      const response = await someBridgeMethod();
      if (isErrorResponse(response)) {
      // response is narrowed to BridgeError
      console.error('Error:', response.error);
      } else {
      // response is successful or redirect
      console.log('Success!');
      }