Skip to main content
The Portal Android SDK uses a structured PortalException hierarchy so you can catch errors at the granularity you need — from individual error cases up to broad categories. Every exception thrown by the SDK is a subclass of PortalException, which itself extends Exception.

Exception hierarchy

PortalException is a sealed class with eight category-level sealed subclasses:

Catching exceptions

Because the hierarchy is sealed, you can catch at any level of specificity.

Catch a specific exception

Catch an entire category

Catch any Portal exception

Handle errors from Result-returning methods

Some methods like sendAsset return a Result instead of throwing. Use onFailure or exceptionOrNull() to inspect the error:

Exception reference

MPC (PortalException.Mpc)

Storage (PortalException.Storage)

Wallet (PortalException.Wallet)

Transaction (PortalException.Transaction)

API (PortalException.Api)

Connect (PortalException.Connect)

Provider (PortalException.Provider)

Blockchain (PortalException.Blockchain)

Migration from previous versions

In previous versions of the Android SDK, errors were thrown as generic Error, Exception, or flat PortalException subclasses like SendAssetArgumentError and PortalHttpUnauthorizedException. These legacy classes are now deprecated and will be removed in a future major version.

What changed

  • All generic Error(...) and Exception(...) throws have been replaced with specific PortalException subclasses.
  • Flat exception classes (SendAssetArgumentError, PortalHttpUnauthorizedException, PasskeyNotSupportedException, PasskeyStorageNotConfiguredException, MpcError, InvalidWalletStateError, StorageAuthError) now extend their corresponding PortalException subcategory. Your existing catch blocks will still work, but you should migrate to the new types.

Before and after

Deprecated classes mapping