Merge branch 'main' into update-filetype-error-handling
This commit is contained in:
commit
f599f7d88b
|
@ -1,5 +1,6 @@
|
|||
import { ElectronAPIs } from 'types/electron';
|
||||
import { ElectronFile } from 'types/upload';
|
||||
import { CustomError } from 'utils/error';
|
||||
import { convertBytesToHumanReadable } from 'utils/file/size';
|
||||
import { addLogLine } from 'utils/logging';
|
||||
import { logError } from 'utils/sentry';
|
||||
|
@ -37,7 +38,12 @@ class ElectronImageProcessorService {
|
|||
);
|
||||
return new Blob([convertedFileData]);
|
||||
} catch (e) {
|
||||
if (
|
||||
e.message !==
|
||||
CustomError.WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED
|
||||
) {
|
||||
logError(e, 'failed to convert heic natively');
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +74,12 @@ class ElectronImageProcessorService {
|
|||
);
|
||||
return thumb;
|
||||
} catch (e) {
|
||||
if (
|
||||
e.message !==
|
||||
CustomError.WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED
|
||||
) {
|
||||
logError(e, 'failed to generate image thumbnail natively');
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,13 +88,6 @@ async function generateImageThumbnail(
|
|||
MAX_THUMBNAIL_SIZE
|
||||
);
|
||||
} catch (e) {
|
||||
logError(
|
||||
e,
|
||||
'Error generating thumbnail using electron image processor',
|
||||
{
|
||||
fileFormat: fileTypeInfo.exactType,
|
||||
}
|
||||
);
|
||||
return await generateImageThumbnailUsingCanvas(file, fileTypeInfo);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -51,6 +51,8 @@ export const CustomError = {
|
|||
UNKNOWN_ERROR: 'Something went wrong, please try again',
|
||||
TYPE_DETECTION_FAILED: (fileFormat: string) =>
|
||||
`type detection failed ${fileFormat}`,
|
||||
WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED:
|
||||
'Windows native image processing is not supported',
|
||||
};
|
||||
|
||||
function parseUploadErrorCodes(error) {
|
||||
|
|
Loading…
Reference in a new issue