Convert throwed object to CustomError

This commit is contained in:
Zagrios
2025-02-19 19:06:23 +01:00
parent 701b3bf141
commit a7d00f22c5
+1 -2
View File
@@ -3,7 +3,6 @@ import { access, mkdir, readdir, lstat, readlink } from "fs/promises";
import path from "path";
import { Observable, concatMap, from } from "rxjs";
import log from "electron-log";
import { BsmException } from "shared/models/bsm-exception.model";
import crypto from "crypto";
import { execSync } from "child_process";
import { tryit } from "../../shared/helpers/error.helpers";
@@ -180,7 +179,7 @@ export function isSubdirectory(parent: string, child: string): boolean {
export async function copyDirectoryWithJunctions(src: string, dest: string, options?: CopyOptions): Promise<void> {
if (isSubdirectory(src, dest)) {
throw { message: `Cannot copy directory '${src}' into itself '${dest}'.`, code: "COPY_TO_SUBPATH" } as BsmException;
throw new CustomError(`Cannot copy directory '${src}' into itself '${dest}'.`, "COPY_TO_SUBPATH");
}
await ensureDir(dest);