fix: Log errors to console when Sentry not installed
This commit is contained in:
@@ -115,7 +115,7 @@ export const uploadToS3FromUrl = async (
|
||||
const endpoint = publicS3Endpoint(true);
|
||||
return `${endpoint}/${key}`;
|
||||
} catch (err) {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
if (process.env.SENTRY_DSN) {
|
||||
Sentry.captureException(err);
|
||||
} else {
|
||||
throw err;
|
||||
@@ -157,7 +157,7 @@ export const getImageByKey = async (key: string) => {
|
||||
const data = await s3.getObject(params).promise();
|
||||
return data.Body;
|
||||
} catch (err) {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
if (process.env.SENTRY_DSN) {
|
||||
Sentry.captureException(err);
|
||||
} else {
|
||||
throw err;
|
||||
|
||||
@@ -34,12 +34,11 @@ async function addImageToArchive(zip, key) {
|
||||
const img = await getImageByKey(key);
|
||||
zip.file(key, img, { createFolders: true });
|
||||
} catch (err) {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
if (process.env.SENTRY_DSN) {
|
||||
Sentry.captureException(err);
|
||||
} else {
|
||||
// error during file retrieval
|
||||
console.error(err);
|
||||
}
|
||||
// error during file retrieval
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user