-
Notifications
You must be signed in to change notification settings - Fork 0
Throwable Capture
Garvit Joshi edited this page Apr 2, 2026
·
3 revisions
This is the easiest path for most applications. Give the client a Throwable, and it builds the Tremor event payload for you.
import in.riido.tremor.client.TremorClient;
String tremorKey = "...";
try (TremorClient client = TremorClient.builder(tremorKey).build()) {
String fingerprint = client.send(new IllegalStateException("checkout failed"));
}Use TremorCaptureOptions when you want request-scoped metadata without mutating the client instance.
import in.riido.tremor.client.TremorCaptureOptions;
import in.riido.tremor.client.TremorClient;
import in.riido.tremor.client.model.TremorBreadcrumb;
import in.riido.tremor.client.model.TremorClientInfo;
import in.riido.tremor.client.model.TremorEnvironment;
import in.riido.tremor.client.model.TremorUser;
String tremorKey = "...";
TremorCaptureOptions options = TremorCaptureOptions.builder()
.machineName("api-1")
.version("1.2.3")
.groupingKey("checkout-failure")
.tag("payments")
.tag("critical")
.putUserCustomData("orderId", "12345")
.environment(
TremorEnvironment.builder()
.osVersion("Linux")
.architecture("amd64")
.processorCount(8)
.locale("en-IN")
.utcOffset(5.5d)
.build())
.client(new TremorClientInfo("my-service", "1.2.3", "https://example.com"))
.user(new TremorUser("user-123", "[email protected]", "Jane Doe"))
.breadcrumb(
TremorBreadcrumb.builder()
.message("started checkout")
.category("lifecycle")
.type("manual")
.lineNumber(42)
.build())
.build();
try (TremorClient client = TremorClient.builder(tremorKey).build()) {
client.send(new IllegalStateException("checkout failed"), options);
}When you call send(Throwable ...), the client automatically maps:
- exception class name
- exception message
- cause chain
- stack trace frames
Current mapping limits:
- stack frames: up to 100 per error
- inner error depth: up to 5
If an exception message is blank, the client falls back to the throwable's simple class name.
You can also use smaller overloads for common cases:
client.send(throwable);
client.send(throwable, tags);
client.send(throwable, userCustomData);
client.send(throwable, tags, userCustomData);
client.send(throwable, options);Use reportAndSuppress(...) when you want best-effort reporting and do not want the original exception rethrown.
client.reportAndSuppress(
TremorCaptureOptions.builder().tag("background-job").build(),
() -> {
runJob();
});String value =
client.reportAndSuppress(
TremorCaptureOptions.builder().tag("cache-refresh").build(),
() -> refreshCache(),
"stale-value");Behavior:
- catches
Exception - reports that exception to Tremor
- suppresses the original execution failure
- suppresses reporting failures too
This API is intentionally explicit because swallowing failures should always be opt-in.
Tremor Java Client | Repository | Issues | README