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

    Function isError

    • Type guard to check if an SDK response has an error status code (400, 401, 403, 404, 424, 426, 500, 501).

      Type Parameters

      Parameters

      • response: T

        The SDK response to check

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

      true if the response is an error, false otherwise

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