| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
This PR enhances error handling for API configuration errors by updating the HTTP error detection mechanism and extending error handling coverage to the CodeQL setup logic. The main improvement is replacing the simple isHTTPError type check with a more robust asHTTPError function that can handle different HTTP error formats.
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file| File | Description |
|---|---|
| src/util.ts | Replaced isHTTPError with asHTTPError function to handle both status and httpStatusCode properties |
| src/api-client.ts | Enhanced wrapApiConfigurationError to handle 429 rate limit errors and use new HTTP error detection |
| src/codeql.ts | Updated CodeQL setup to use API configuration error wrapping and removed specific RequestError handling |
| src/upload-lib.ts | Updated to use new asHTTPError function for consistent error handling |
| src/trap-caching.ts | Updated import and usage to use new HTTP error detection method |
| src/status-report.ts | Updated import and usage to use new HTTP error detection method |
| src/feature-flags.ts | Updated to use new HTTP error detection method |
| lib/*.js | Generated JavaScript files reflecting the TypeScript changes |
Sorry, something went wrong.
| httpError.message.includes("API rate limit exceeded") || | ||
| httpError.message.includes("commit not found") || | ||
| httpError.message.includes("Resource not accessible by integration") || | ||
| /ref .* not found in this repository/.test(httpError.message) |
There was a problem hiding this comment.
[nitpick] The error message check has been made more generic by removing 'for installation', but this could potentially match unintended error messages. Consider using a more specific pattern or combining with status code checks for better accuracy.
| httpError.message.includes("API rate limit exceeded") || | |
| httpError.message.includes("commit not found") || | |
| httpError.message.includes("Resource not accessible by integration") || | |
| /ref .* not found in this repository/.test(httpError.message) | |
| ((httpError.message.includes("API rate limit exceeded") && | |
| (httpError.status === 403 || httpError.status === 429)) || | |
| httpError.message.includes("commit not found") || | |
| httpError.message.includes("Resource not accessible by integration") || | |
| /ref .* not found in this repository/.test(httpError.message)) |
Sorry, something went wrong.
| } catch (rawError) { | ||
| const e = api.wrapApiConfigurationError(rawError); | ||
| const ErrorClass = | ||
| e instanceof util.ConfigurationError || |
There was a problem hiding this comment.
[nitpick] The removal of the RequestError status 429 check from the ErrorClass condition logic appears intentional since this is now handled by wrapApiConfigurationError, but the comment should be updated to reflect that rate limiting is now handled upstream.
| e instanceof util.ConfigurationError || | |
| e instanceof util.ConfigurationError || | |
| // Rate limiting (HTTP 429) is now handled upstream by wrapApiConfigurationError. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM. Just a couple of small suggestions I thought of while reviewing.
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for implementing those suggestions, and even making the checks in asHTTPError more thorough than suggested!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Update generic API configuration error handling to handle HTTP errors with the httpStatusCode property instead of the statusCode property, and update the CodeQL setup logic to use this error handling.
Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
How did/will you validate this change?
If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Merge / deployment checklist