Skip to content

Documentation / expo / hasError

Function: hasError()

hasError(s)

hasError(s): s is EmbeddedWalletErrorState

A type predicate to narrow the Embedded Wallet state to the Error state.

Parameters

s: EmbeddedWalletState

Returns

s is EmbeddedWalletErrorState

Example

ts
import {useEmbeddedWallet, useEmbeddedSolanaWalet, isConnected} from '@privy-io/expo';

const wallet = useEmbeddedWallet();
/// OR
const wallet = useEmbeddedSolanaWallet();

{hasError(wallet) && (
  <>Error: {wallet.error}</>
)}

hasError(s)

hasError(s): s is EmbeddedSolanaWalletErrorState

A type predicate to narrow the Embedded Wallet state to the Error state.

Parameters

s: EmbeddedSolanaWalletState

Returns

s is EmbeddedSolanaWalletErrorState

Example

ts
import {useEmbeddedWallet, useEmbeddedSolanaWalet, isConnected} from '@privy-io/expo';

const wallet = useEmbeddedWallet();
/// OR
const wallet = useEmbeddedSolanaWallet();

{hasError(wallet) && (
  <>Error: {wallet.error}</>
)}