Classify nested Neon connection failures

This commit is contained in:
Theodore Song
2026-08-19 08:31:01 -04:00
parent f75e6b0877
commit 720aa75d78
2 changed files with 14 additions and 3 deletions
+5
View File
@@ -47,5 +47,10 @@ assert.equal(compactedState.signal_ledger.expired_ungraded, 7);
assert.equal(providerErrorCode(new Error("403 Forbidden")), "authorization_failed");
assert.equal(providerErrorCode(new Error("invalid connection string")), "invalid_connection_string");
assert.equal(providerErrorCode(Object.assign(new Error("database rejected login"), { code: "28P01" })), "authorization_failed");
const nestedFetchError = Object.assign(new Error("Error connecting to database"), {
name: "NeonDbError",
sourceError: Object.assign(new TypeError("fetch failed"), { cause: { code: "ENOTFOUND" } }),
});
assert.equal(providerErrorCode(nestedFetchError), "dns_failed");
console.log("server state tests passed");