mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-07-25 14:30:55 +02:00
Align error logging with admin dashboard field conventions
All warn/error log calls now use field names the dashboard's decorate()
function recognizes: `code` for the error code pill, `httpStatus` for the
status badge and severity bucket, `url` for the sidebar link, and
`repoId` for the repository link.
Key changes:
- Streamer errors surface code, httpStatus, url, and nested err in Raw tab
- Nested `{ err: serializeError(e) }` replaced with spread pattern so
error fields (name, message, status) appear at the top level
- Raw Error objects in catch blocks now go through serializeError()
- Rate limit, token, and PR 404 warnings include code + httpStatus
- Dashboard stack walker traverses both `cause` and `err` chains
- Dashboard Raw tab renders repoId, filePath, upstream*, err, and cause
- trimRawArg recursively trims stacks in nested err/cause chains
- clampPayload strips heavy nested fields before falling back to
truncated placeholder, preserving flat diagnostic fields
This commit is contained in:
@@ -62,6 +62,8 @@ export function octokit(token: string) {
|
||||
throttle: {
|
||||
onRateLimit: (retryAfter, options, _o, retryCount) => {
|
||||
logger.warn("github primary rate limit hit", {
|
||||
code: "github_rate_limit",
|
||||
httpStatus: 429,
|
||||
method: options.method,
|
||||
url: options.url,
|
||||
retryAfter,
|
||||
@@ -73,6 +75,8 @@ export function octokit(token: string) {
|
||||
},
|
||||
onSecondaryRateLimit: (retryAfter, options, _o, retryCount) => {
|
||||
logger.warn("github secondary rate limit hit", {
|
||||
code: "github_secondary_rate_limit",
|
||||
httpStatus: 429,
|
||||
method: options.method,
|
||||
url: options.url,
|
||||
retryAfter,
|
||||
@@ -193,8 +197,9 @@ export async function getToken(repository: Repository) {
|
||||
}
|
||||
}
|
||||
logger.warn("token refresh failed; falling back", {
|
||||
code: "token_refresh_failed",
|
||||
httpStatus: res.status,
|
||||
username: repository.owner.model.username,
|
||||
status: res.status,
|
||||
});
|
||||
// fall through to the checkToken path / config.GITHUB_TOKEN
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user