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:
parent
51e172d91f
commit
0ff2eb8224
@ -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!");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user