Api

sealed class Api : PortalException

Base exception class for API and network-related errors.

This class serves as the parent for all recoverable errors related to API and network operations.

Inheritors

Types

Link copied to clipboard
open class HttpBadRequest(val rawBody: String, message: String, cause: Throwable? = null) : PortalException.Api

Thrown when the backend responds with HTTP 400 Bad Request.

Link copied to clipboard
class HttpRequestFailed(message: String, cause: Throwable? = null, val statusCode: Int? = null) : PortalException.Api

Thrown when an HTTP request fails with a non-success status code other than 400 (which throws HttpBadRequest) or 401 (which throws HttpUnauthorized). Covers 4xx ≥ 402, all 5xx, and unknown status codes.

Link copied to clipboard
open class HttpUnauthorized(message: String, cause: Throwable? = null) : PortalException.Api

Thrown when an HTTP request is unauthorized (401).

Link copied to clipboard
open class RpcError(val code: Int, val message: String, cause: Throwable? = null) : PortalException.Api

Thrown when an RPC request fails.

Link copied to clipboard
class YieldApiBadRequest(val rawBody: String, message: String, cause: Throwable? = null) : PortalException.Api.HttpBadRequest

Thrown when the Yield API returns a 400 Bad Request error.

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard
open val message: String?