Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

test(sdk): stop calling 503 the only retryable error in comments

Yudhi Armyndharis0e88c6eee87e
diff --git a/sdk/go/client_test.go b/sdk/go/client_test.go
index 0434eeac1..6a4712d9b 100644
--- a/sdk/go/client_test.go
+++ b/sdk/go/client_test.go
@@ -893,8 +893,8 @@ func TestUpdateGroupSettingsOmitsUnsetFields(t *testing.T) {
}
}
-// A 503 is the gateway's answer when the engine never confirmed an operation — a transport failure,
-// and the one sentinel here worth retrying. It used to have none, while the permanent 501 did.
+// A 503 is the gateway's answer when the engine never confirmed an operation: a transport failure,
+// which is worth retrying, as a 429 is. It used to have no sentinel, while the permanent 501 did.
func TestServiceUnavailableIsRetryableSentinel(t *testing.T) {
rt := &recordTransport{
status: 503,
diff --git a/sdk/java/src/test/java/com/rmyndharis/openwa/errors/ErrorsTest.java b/sdk/java/src/test/java/com/rmyndharis/openwa/errors/ErrorsTest.java
index 661919f3e..40368f755 100644
--- a/sdk/java/src/test/java/com/rmyndharis/openwa/errors/ErrorsTest.java
+++ b/sdk/java/src/test/java/com/rmyndharis/openwa/errors/ErrorsTest.java
@@ -26,9 +26,9 @@ class ErrorsTest {
@Test
void mapsTheRetryableStatusToItsOwnSubclass() {
- // 503 is the gateway's answer when the engine never confirmed an operation — a transport
- // failure, and the only typed error here worth retrying. It used to fall through to the base
- // class while 501, which is permanent, had a subclass of its own.
+ // 503 is the gateway's answer when the engine never confirmed an operation: a transport
+ // failure, which is worth retrying, as a 429 is. It used to fall through to the base class
+ // while 501, which is permanent, had a subclass of its own.
String body = "{\"statusCode\":503,\"message\":\"WhatsApp did not answer\",\"error\":\"Service Unavailable\"}";
OpenWAApiError e = OpenWAApiError.fromResponse(503, "Service Unavailable", body, "POST /x");
assertTrue(e instanceof OpenWAServiceUnavailableError);
diff --git a/sdk/javascript/test/client.test.ts b/sdk/javascript/test/client.test.ts
index d4351ba67..74621b2da 100644
--- a/sdk/javascript/test/client.test.ts
+++ b/sdk/javascript/test/client.test.ts
@@ -102,9 +102,9 @@ describe('OpenWAClient', () => {
});
it('maps a 503 to OpenWAServiceUnavailableError', async () => {
- // The gateway answers 503 when the engine never confirmed an operation. It is the only typed error
- // here that is worth retrying, and it used to fall through to the base class while 501 — which is
- // permanent — had a subclass of its own.
+ // The gateway answers 503 when the engine never confirmed an operation: a transport failure, which
+ // is worth retrying, as a 429 is. It used to fall through to the base class while 501, which is
+ // permanent, had a subclass of its own.
const t = new MockTransport().on('POST', '/api/sessions/s1/messages/send-text', {
status: 503,
body: { statusCode: 503, message: 'WhatsApp did not answer in time', error: 'Service Unavailable' },
diff --git a/sdk/python/tests/test_sdk.py b/sdk/python/tests/test_sdk.py
index 38d06323e..9da72956c 100644
--- a/sdk/python/tests/test_sdk.py
+++ b/sdk/python/tests/test_sdk.py
@@ -146,9 +146,9 @@ class TestClientCore:
make_client(backend).sessions.get("missing")
def test_maps_503_to_service_unavailable(self):
- # The gateway answers 503 when the engine never confirmed an operation -- the one typed error
- # here worth retrying. It used to fall through to the base class while the permanent 501 had a
- # subclass of its own.
+ # The gateway answers 503 when the engine never confirmed an operation: a transport failure,
+ # which is worth retrying, as a 429 is. It used to fall through to the base class while the
+ # permanent 501 had a subclass of its own.
backend = MockBackend()
backend.on("GET", "/api/sessions/s1", 503, {
"statusCode": 503, "message": "WhatsApp did not answer", "error": "Service Unavailable"