mirror of
https://github.com/firstsun-dev/git-files-sync.git
synced 2026-07-22 17:20:30 +00:00
Loading .gitignore files probes paths that often don't exist remotely. getFile already treats 404 as "empty file" (handleFileNotFound) and the gitignore lookup ignores failures, but safeRequest logged every 404 as an error — twice, because its own catch re-caught the error it had just thrown. This produced scary "Git Service Request Failed (404): Not Found" console output during a normal pull/refresh. Restructure safeRequest so the catch only wraps the network call (no double-logging of HTTP-status errors), and log an expected 404 at debug level instead of error. Non-404 statuses are still logged as errors and all statuses still throw so callers can handle them. Add a debug level to the logger and regression tests for 404 vs 500. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DwioG4CNKUBuKiZdowLFWe
7 lines
362 B
TypeScript
7 lines
362 B
TypeScript
const PREFIX = '[git-file-sync]';
|
|
|
|
export const logger = {
|
|
error: (message: string, ...args: unknown[]) => console.error(`${PREFIX} ${message}`, ...args),
|
|
warn: (message: string, ...args: unknown[]) => console.warn(`${PREFIX} ${message}`, ...args),
|
|
debug: (message: string, ...args: unknown[]) => console.debug(`${PREFIX} ${message}`, ...args),
|
|
};
|