Merge pull request #12 from vraravam/patch-1
Some checks failed
CI / general (push) Has been cancelled

Update discard.ts to print error message using the real file
This commit is contained in:
mr. m 2024-12-24 12:32:27 +01:00 committed by GitHub
commit 0b109c2dd4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,9 +10,9 @@ import { ENGINE_DIR } from '../constants'
export const discard = async (file: string): Promise<void> => {
const realFile = resolve(ENGINE_DIR, file)
log.info(`Discarding ${file}...`)
log.info(`Discarding ${realFile}...`)
if (!existsSync(realFile)) throw new Error(`File ${file} does not exist`)
if (!existsSync(realFile)) throw new Error(`File ${realFile} does not exist`)
if (!statSync(realFile).isFile()) throw new Error('Target must be a file.')
try {