FeedbackException

Base sealed exception class for all errors produced by FeedbackClient.

Every method in FeedbackClient encapsulates network transport failures, HTTP errors, authentication rejections, and serialization anomalies into one of the specialized subclasses of FeedbackException. This enables concise, uniform error handling across UI layers:

Exhaustive Error Handling Example

try {
val result = client.submit(draft, userToken)
showSuccessToast("Submitted: ${result.submissionId}")
} catch (e: FeedbackException.AuthenticationRequired) {
showLoginPrompt("Please sign in to submit feedback.")
} catch (e: FeedbackException.UnexpectedStatus) {
Log.e("Feedback", "Server error code: ${e.code}, message: ${e.serverMessage}")
showErrorSnackbar("Submission failed: ${e.serverMessage}")
} catch (e: FeedbackException.InvalidResponse) {
Log.e("Feedback", "Network connection or parsing failed", e.cause)
showErrorSnackbar("Unable to reach the server. Please check your internet connection.")
} catch (e: FeedbackException) {
showErrorSnackbar("An unexpected error occurred.")
}

Parameters

message

Human-readable error description.

cause

Underlying root cause exception, when available.

Inheritors

Types

Link copied to clipboard

Raised when attempting to perform an action that requires a registered or permitted user token on an app configured with anonymous restrictions (HTTP 401 authentication_required).

Link copied to clipboard

Raised when a network transport failure occurs (such as connection timeouts, DNS resolution errors, or SSL handshake issues) or when the server returns a malformed response body that cannot be parsed.

Link copied to clipboard
class UnexpectedStatus(val code: Int, val serverMessage: String) : FeedbackException

Raised when the server responds with an HTTP status code outside the accepted success range for the specific endpoint.

Link copied to clipboard

Raised when an attachment upload HTTP request returned status 200, but the resulting JSON payload could not be decoded into a valid FeedbackAttachment descriptor.

Properties

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