Skip to content

Commit 77d6cb7

Browse files
authored
Improve error message when image resizing failed (#3148)
1 parent 1942d22 commit 77d6cb7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/gitbook/src/routes/image.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ export async function serveResizedImage(
107107
try {
108108
const response = await resizeImage(url, options);
109109
if (!response.ok) {
110-
throw new Error('Failed to resize image');
110+
throw new Error(`Failed to resize image, received status code ${response.status}`);
111111
}
112112

113113
return response;
114114
} catch (error) {
115115
// Redirect to the original image if resizing fails
116-
console.error('Failed to resize image', error);
116+
console.warn('Error while resizing image, redirecting to original', error);
117117
return NextResponse.redirect(url, 302);
118118
}
119119
}

0 commit comments

Comments
 (0)