Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(sdk): say how an oversized retry delay reads in Go and Java

Yudhi Armyndharis1f1b566c610c
diff --git a/sdk/go/errors.go b/sdk/go/errors.go
index 85fe57f82..a7e533b1d 100644
--- a/sdk/go/errors.go
+++ b/sdk/go/errors.go
@@ -97,7 +97,9 @@ type APIError struct {
Code string
// RetryAfter is how long to wait before retrying: the body's
// retryAfterSeconds when present, else the Retry-After header (seconds or
- // an HTTP date). Zero when the response names no delay.
+ // an HTTP date). Zero when the response names no delay. A delay too long
+ // for a time.Duration is reported as the largest Duration (about 292
+ // years), a sentinel for "do not retry", not the delay the server named.
RetryAfter time.Duration
// Header is the response header.
Header http.Header
diff --git a/sdk/java/src/main/java/com/rmyndharis/openwa/errors/OpenWAApiError.java b/sdk/java/src/main/java/com/rmyndharis/openwa/errors/OpenWAApiError.java
index 2e0cc478b..6e4f5e7b0 100644
--- a/sdk/java/src/main/java/com/rmyndharis/openwa/errors/OpenWAApiError.java
+++ b/sdk/java/src/main/java/com/rmyndharis/openwa/errors/OpenWAApiError.java
@@ -83,7 +83,9 @@ public class OpenWAApiError extends OpenWAError {
/**
* Seconds to wait before retrying: the body's {@code retryAfterSeconds} when present, else the
- * {@code Retry-After} header (seconds or an HTTP date), else {@code null}.
+ * {@code Retry-After} header (seconds or an HTTP date), else {@code null}. A body value beyond the
+ * range of a {@code long} reads as {@code Long.MAX_VALUE}; a header of more than 18 digits, or a
+ * date too far ahead to convert, reads as {@code null}, the same as an unreadable one: no hint.
*/
public Long retryAfterSeconds() {
return retryAfterSeconds;