Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/backends/s3/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ export async function getObject(
const successResponse = unwrapOk(response);
if (successResponse.status !== 200 && successResponse.status !== 206) {
const errMessage = `Get Object Failed: ${successResponse.statusText}`;
logger.warn(errMessage);
reportToSentry(errMessage);
logger.info(errMessage);
} else {
logger.info(`Get Object Successful: ${successResponse.statusText}`);
}
Comment on lines 55 to 60
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Differentiate 404 from genuine errors.

The current implementation treats all non-200/206 responses (including 403, 500, 503, etc.) as info-level logs without Sentry reporting. This doesn't align with the PR objective to skip reporting only for 404 responses. Genuine server errors should still be logged at warn level and reported to Sentry.

As per the past review comments, 404s should be treated as normal while other error codes need warnings and Sentry reporting.

Apply this diff to handle 404 separately:

 const successResponse = unwrapOk(response);
-if (successResponse.status !== 200 && successResponse.status !== 206) {
+if (successResponse.status === 404) {
+  logger.info(`Get Object Not Found: ${successResponse.statusText}`);
+} else if (successResponse.status !== 200 && successResponse.status !== 206) {
   const errMessage = `Get Object Failed: ${successResponse.statusText}`;
-  logger.info(errMessage);
+  logger.warn(errMessage);
+  reportToSentry(errMessage);
 } else {
   logger.info(`Get Object Successful: ${successResponse.statusText}`);
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (successResponse.status !== 200 && successResponse.status !== 206) {
const errMessage = `Get Object Failed: ${successResponse.statusText}`;
logger.warn(errMessage);
reportToSentry(errMessage);
logger.info(errMessage);
} else {
logger.info(`Get Object Successful: ${successResponse.statusText}`);
}
if (successResponse.status === 404) {
logger.info(`Get Object Not Found: ${successResponse.statusText}`);
} else if (successResponse.status !== 200 && successResponse.status !== 206) {
const errMessage = `Get Object Failed: ${successResponse.statusText}`;
logger.warn(errMessage);
reportToSentry(errMessage);
} else {
logger.info(`Get Object Successful: ${successResponse.statusText}`);
}
🤖 Prompt for AI Agents
In src/backends/s3/objects.ts around lines 55 to 60, non-200/206 responses are
currently logged at info level and never reported; update the logic to treat 404
as the only non-error to skip reporting: if status is 200 or 206 log success
(info); else if status is 404 log a concise info message and do not send to
Sentry; otherwise (any other status like 403/500/503) log at warn level and
send/report the error to Sentry including status and statusText for debugging.
Ensure messages include both status and statusText and that the Sentry report
contains the response details.

Expand Down
3 changes: 1 addition & 2 deletions src/backends/swift/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,7 @@ export async function getObject(
const successResponse = unwrapOk(response);
if (successResponse.status !== 200 && successResponse.status !== 206) {
const errMessage = `Get Object Failed: ${successResponse.statusText}`;
logger.warn(errMessage);
reportToSentry(errMessage);
logger.info(errMessage);
} else {
logger.info(`Get Object Successful: ${successResponse.statusText}`);
}
Expand Down
Loading