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

    Function isServerError

    • Type guard to check if an SDK response has a server error status code (500, 501).

      Type Parameters

      Parameters

      • response: T

        The SDK response to check

      Returns response is Extract<T, { status_code: 500 | 501 }>

      true if the response is a server error, false otherwise

      const response = await someBridgeMethod();
      if (isServerError(response)) {
      // response narrowed to server error variants, `error` is available
      console.error(response.error);
      }