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

    Function isError

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

      Type Parameters

      Parameters

      • response: T

        The JSBridge response to check

      Returns response is Extract<T, { error: string }>

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

      const response = await someBridgeMethod();
      if (isError(response)) {
      // response narrowed to error variants — error: string is guaranteed
      console.error('Error:', response.error);
      } else {
      console.log('Success!');
      }