Skip to content

Commit 5bd6fbc

Browse files
author
Nicolas Dorseuil
committed
update comment
1 parent fe7d132 commit 5bd6fbc

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

packages/open-next/src/adapters/image-optimization-adapter.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ export async function defaultHandler(
115115
);
116116
return buildSuccessResponse(result, options?.streamCreator, etag);
117117
} catch (e: any) {
118-
// All image-related errors should be treated as client errors
119118
// Extract status code from error or default to 400 Bad Request
120119
const statusCode = e.statusCode || 400;
121120
const errorMessage = e.message || "Failed to process image request";
@@ -339,7 +338,7 @@ async function downloadHandler(
339338

340339
// Main handler logic with clearer error paths
341340
try {
342-
// EXTERNAL IMAGE HANDLING
341+
// remote image URL => download the image from the URL
343342
if (url.href.toLowerCase().match(/^https?:\/\//)) {
344343
try {
345344
pipeStream(https.get(url), res, false);
@@ -349,15 +348,15 @@ async function downloadHandler(
349348
return;
350349
}
351350

352-
// INTERNAL IMAGE HANDLING (S3)
351+
// local image => download the image from the provided ImageLoader (default is S3)
353352
try {
354353
const response = await loader.load(url.href);
355354

356355
// Handle empty response body
357356
if (!response.body) {
358357
const message = "Empty response body from the S3 request.";
359358
const clientError = new IgnorableError(message, 400);
360-
error("Empty response from S3", clientError);
359+
error("Empty response from ImageLoader", clientError);
361360

362361
res.statusCode = 400;
363362
res.setHeader("Content-Type", "text/plain");

0 commit comments

Comments
 (0)