mirror of
https://github.com/upscayl/upscayl.git
synced 2024-09-24 03:18:28 +02:00
Add file access error
This commit is contained in:
parent
51e172d91f
commit
0ff2eb8224
@ -1,3 +1,4 @@
|
|||||||
|
import fs from "fs";
|
||||||
import sharp, { FormatEnum } from "sharp";
|
import sharp, { FormatEnum } from "sharp";
|
||||||
import logit from "./logit";
|
import logit from "./logit";
|
||||||
import { getMainWindow } from "../main-window";
|
import { getMainWindow } from "../main-window";
|
||||||
@ -15,6 +16,12 @@ const convertAndScale = async (
|
|||||||
|
|
||||||
const originalImage = await sharp(originalImagePath).metadata();
|
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) {
|
if (!mainWindow || !originalImage) {
|
||||||
throw new Error("Could not grab the original image!");
|
throw new Error("Could not grab the original image!");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user