-
Notifications
You must be signed in to change notification settings - Fork 0
Error Handling
Garvit Joshi edited this page Apr 2, 2026
·
3 revisions
All send(...) methods are synchronous. On success, they return the Tremor fingerprint assigned by the server.
| Failure type | Exception |
|---|---|
| Invalid client configuration or event payload | IllegalArgumentException |
| Network or transport failure | TremorClientException |
| Non-2xx response from Tremor | TremorApiException |
| Invalid or malformed JSON during request/response handling | TremorSerializationException |
TremorApiException is used when Tremor responds but rejects the request.
It carries:
- HTTP status code
- response body
- request URL
Example:
String tremorKey = "...";
try (TremorClient client = TremorClient.builder(tremorKey).build()) {
client.send(new IllegalStateException("checkout failed"));
} catch (TremorApiException e) {
System.err.println(e.getStatusCode());
System.err.println(e.getResponseBody());
System.err.println(e.getUrl());
}TremorClientException wraps transport failures such as:
- connection refused
- timeouts
- connection reset
- DNS failures
Use this when the request could not be completed at all.
TremorSerializationException is raised when:
- the event cannot be serialized
- the success response is not valid JSON
- the response does not contain
fingerprint - the response fingerprint is blank
Validation failures happen before the HTTP request is executed.
Examples:
- blank client key
- null event
- null throwable
- missing
error.className - missing
error.message - too many tags
- invalid structured custom data depth
These failures use IllegalArgumentException.
String tremorKey = "...";
try (TremorClient client =
TremorClient.builder(tremorKey).baseUrl("https://tremor.example.com/tremor").build()) {
String fingerprint = client.send(new IllegalStateException("checkout failed"));
} catch (TremorApiException e) {
// Tremor rejected the request
} catch (TremorClientException e) {
// Transport problem
} catch (IllegalArgumentException e) {
// Local configuration or payload problem
}reportAndSuppress(...) is different by design:
- it catches
Exception - it tries to report the failure
- it suppresses the original exception
- it suppresses reporting failures too
Use it only when swallowing the execution failure is intentional.
Tremor Java Client | Repository | Issues | README