Errors
Every failure from a platform call is a FlowCatalystException, an unchecked exception that carries one
variant of the sealed interface SdkError. Because the interface is sealed, a pattern-matching
switch can handle every case and the compiler tells you when a new one appears.
try { client.eventTypes().get(id);} catch (FlowCatalystException e) { switch (e.error()) { case SdkError.NotFound nf -> handleMissing(); case SdkError.RateLimited rl -> backOff(rl.retryAfter()); case SdkError.Validation v -> log(v.errors()); default -> throw e; }}getMessage() is the human-readable text. The exception’s cause is set for Network and
TokenFetchFailed.
The variants
Section titled “The variants”| Variant | Fields | When |
|---|---|---|
MissingCredentials |
message |
The client id or secret is not set. |
InvalidCredentials |
message |
The token endpoint rejected the credentials (401 or 403). |
TokenExpired |
message |
A request was rejected with 401 and could not be repaired by the one refresh, or your token supplier threw. |
TokenFetchFailed |
message, cause |
The token call itself failed. |
Network |
message, cause |
DNS, refused, reset, an unreadable response, an interrupt, or a request body that could not be serialised. |
Timeout |
message, duration |
The request exceeded the configured timeout. |
HttpStatus |
status, message, body |
Any other non-2xx status. The raw body is kept. |
Validation |
message, errors (field to messages) |
422. |
NotFound |
message |
404. |
Forbidden |
message |
403. |
Conflict |
message, code |
409. code is the platform error code when present, such as INGESTION_CODE_EXISTS. |
RateLimited |
message, retryAfter |
429, once retries are spent. |
OutcomeUnknown |
message, method, url, status (nullable), body (nullable), cause (nullable) |
A request that is not repeatable (a plain POST) got 502, 503 or 504, or failed or timed out after it may have been sent. The SDK did not send it again: the platform may have applied it. Read the state before you send it again. |
PartialFailure |
message |
Part of a multi-step client-side operation failed. Thrown as DefinitionSyncException. |
Mapping from the response
Section titled “Mapping from the response”The platform’s error body is {"error": "<CODE>", "message": "<text>"}. The SDK prefers the human
message and falls back to the code, then to HTTP <status>.
| Status | Variant |
|---|---|
| 401 | TokenExpired |
| 403 | Forbidden |
| 404 | NotFound |
| 409 | Conflict |
| 422 | Validation |
| 429 | RateLimited |
| anything else | HttpStatus |
A 400 is an HttpStatus, not a Validation. The platform answers many refusals with 400 and a
code, such as SECRET_VALUE_MASKED, NOT_A_SECRET and INVALID_ON_BEHALF_OF; read body (or the
message) to tell them apart. Validation is only for 422.
Retries happen before an error is thrown. 408 and 429 are retried for every request; 502, 503, 504 and a failure after the request was sent are retried only for a repeatable request, and end in OutcomeUnknown for any other. 500 is not retried.
See Auth.
Partial sync failures
Section titled “Partial sync failures”definitions().sync(...), syncAll(...) and syncGrouped(...) throw DefinitionSyncException, a
subclass of FlowCatalystException carrying SdkError.PartialFailure, when any category could not be
synced. Its typed accessors (result(), results(), resultsByApplication()) hold what did sync, so
a deploy step can log the partial outcome. A plain catch (FlowCatalystException e) still catches it.
See Declarations.
Other exceptions
Section titled “Other exceptions”Not everything is a FlowCatalystException. These are thrown for problems the SDK finds before it sends
anything, or for local I/O:
| Exception | When |
|---|---|
IllegalArgumentException |
A bare event type or dispatch-job code, an invalid CreateDispatchJobDto (validate() names the first rule broken), event data that cannot be serialised. Nothing is written. |
IllegalStateException |
build() without credentials, an OutboxManager with no client id, a DefinitionSet code missing from the environment. |
PushException |
A refused push; code() is one of TOPIC_INVALID, TYPE_INVALID, TYPE_RESERVED, DATA_INVALID, DATA_NOT_OBJECT, DATA_TOO_LARGE, PUSH_ID_INVALID, CLIENT_INVALID. |
TicketException |
A push ticket request or key that is not valid. |
JdbcOutboxDriver.OutboxPersistenceException |
The outbox INSERT failed; wraps the SQLException. |
WebhookSignature.WebhookSignatureException |
verify(...) failed; code() says why. See Webhooks. |
Read next
Section titled “Read next”- Auth, Outbox
- The wire error format: errors reference