Skip to content

Commit 606a4dd

Browse files
committed
fix: silence GH rate limiting
1 parent c698694 commit 606a4dd

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed
Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { RequestError } from "@octokit/types";
12
import {
23
ActivityExecuteInput,
34
ActivityInboundCallsInterceptor,
45
Next,
56
} from "@temporalio/worker";
6-
77
export class GithubCastKnownErrorsInterceptor
88
implements ActivityInboundCallsInterceptor
99
{
@@ -14,25 +14,15 @@ export class GithubCastKnownErrorsInterceptor
1414
try {
1515
return await next(input);
1616
} catch (err: unknown) {
17-
const maybeGhError = err as {
18-
status?: number;
19-
name?: string;
20-
type?: string;
21-
};
17+
const maybeGhError = err as RequestError;
2218

23-
if (
24-
maybeGhError.status === 403 &&
25-
maybeGhError.type === "RequestError" &&
26-
maybeGhError.name === "HttpError"
27-
) {
19+
if (maybeGhError.status === 403 && maybeGhError.name === "HttpError") {
2820
throw {
2921
__is_dust_error: true,
3022
message: "Github rate limited",
3123
type: "github_rate_limited",
3224
};
3325
}
34-
35-
throw err;
3626
}
3727
}
3828
}

0 commit comments

Comments
 (0)