1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-12 01:40:53 +01:00

Add file access error

This commit is contained in:
Nayam Amarshe 2023-10-14 13:48:43 +05:30
parent 51e172d91f
commit 0ff2eb8224

View File

@ -1,3 +1,4 @@
import fs from "fs";
import sharp, { FormatEnum } from "sharp";
import logit from "./logit";
import { getMainWindow } from "../main-window";
@ -15,6 +16,12 @@ const convertAndScale = async (
const originalImage = await sharp(originalImagePath).metadata();
fs.access(originalImagePath, fs.constants.F_OK, (err) => {
if (err) {
throw new Error("Could not grab the original image!");
}
});
if (!mainWindow || !originalImage) {
throw new Error("Could not grab the original image!");
}