diff --git a/dist/index.js b/dist/index.js index d6d5ab60..07039601 100644 --- a/dist/index.js +++ b/dist/index.js @@ -761,6 +761,7 @@ class IssuesProcessor { }); } getRateLimit() { + var _a; return __awaiter(this, void 0, void 0, function* () { const logger = new logger_1.Logger(); try { @@ -768,7 +769,13 @@ class IssuesProcessor { return new rate_limit_1.RateLimit(rateLimitResult.data.rate); } catch (error) { - logger.error(`Error when getting rateLimit: ${error.message}`); + const status = error === null || error === void 0 ? void 0 : error.status; + const message = (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : String(error); + if (status === 404 && message.includes('Rate limiting is not enabled')) { + logger.warning('Rate limiting is not enabled on this instance. Proceeding without rate limit checks.'); + return undefined; + } + logger.error(`Error when getting rateLimit: ${message}`); } }); } diff --git a/src/classes/issues-processor.ts b/src/classes/issues-processor.ts index 3f7b5563..26419173 100644 --- a/src/classes/issues-processor.ts +++ b/src/classes/issues-processor.ts @@ -660,11 +660,22 @@ export class IssuesProcessor { async getRateLimit(): Promise { const logger: Logger = new Logger(); + try { const rateLimitResult = await this.client.rest.rateLimit.get(); return new RateLimit(rateLimitResult.data.rate); - } catch (error) { - logger.error(`Error when getting rateLimit: ${error.message}`); + } catch (error: unknown) { + const status = (error as {status?: number})?.status; + const message = (error as {message?: string})?.message ?? String(error); + + if (status === 404 && message.includes('Rate limiting is not enabled')) { + logger.warning( + 'Rate limiting is not enabled on this instance. Proceeding without rate limit checks.' + ); + return undefined; + } + + logger.error(`Error when getting rateLimit: ${message}`); } }