aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsrc/srcom/utils.ts11
-rw-r--r--tests/srcom/posts.test.ts4
2 files changed, 13 insertions, 2 deletions
diff --git a/src/srcom/utils.ts b/src/srcom/utils.ts
index 77c57eb..3239633 100755
--- a/src/srcom/utils.ts
+++ b/src/srcom/utils.ts
@@ -110,6 +110,17 @@ export async function getAll<T>(
attempts++;
if (attempts > 5) break;
await delay(30_000);
+ } else if (res.status === 400) {
+ const body = await res.json();
+ // Above 10k speedrun.com just breaks
+ // With this error message
+ if (body.message === "Invalid pagination values.") break;
+ else {
+ // This is an unexpected error
+ // So try to walk it off
+ console.error(body);
+ break;
+ }
}
continue;
} else attempts = 0;
diff --git a/tests/srcom/posts.test.ts b/tests/srcom/posts.test.ts
index aad5f10..788cd53 100644
--- a/tests/srcom/posts.test.ts
+++ b/tests/srcom/posts.test.ts
@@ -4,8 +4,8 @@ import { posts } from "../../src/srcom/posts.ts";
Deno.test("Get user posts by username", async () => {
const res = await posts("1", { outputType: "plain" });
const expected = `Posts: 1
-Site Forums: 588
+Site Forums: 589
Game Forums: 779
-Total: 1367`;
+Total: 1368`;
assertEquals(res, expected);
});