🎨 Improve error messaging

This commit is contained in:
C-3PO 2018-09-30 14:48:30 +02:00
parent d60c9097ab
commit 161601d3d7
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

@ -91,7 +91,7 @@ export default async function getPatch({ product, from, to, sourceDirectory, tar
fs.rename(outputNameTemp, outputName, (renameError) => { fs.rename(outputNameTemp, outputName, (renameError) => {
if (renameError) { if (renameError) {
throw new Error(`Could not rename output file "${outputNameTemp}": ${renameError.name}`); throw new Error(`Could not rename output file "${outputNameTemp}": ${renameError.message}`);
} }
}); });
} catch (error) { } catch (error) {
@ -115,18 +115,18 @@ export default async function getPatch({ product, from, to, sourceDirectory, tar
if (sourceDir === targetDir) { if (sourceDir === targetDir) {
fs.unlink(sourceFile, (deleteError) => { fs.unlink(sourceFile, (deleteError) => {
if (deleteError) { if (deleteError) {
throw new Error(`Could not delete old source file "${sourceFile}": ${deleteError.name}`); throw new Error(`Could not delete old source file "${sourceFile}": ${deleteError.message}`);
} }
fs.rename(outputNameTemp, outputName, (renameError) => { fs.rename(outputNameTemp, outputName, (renameError) => {
if (renameError) { if (renameError) {
throw new Error(`Could not rename output file "${outputNameTemp}": ${renameError.name}`); throw new Error(`Could not rename output file "${outputNameTemp}": ${renameError.message}`);
} }
}); });
}); });
} else { } else {
fs.rename(outputNameTemp, outputName, (renameError) => { fs.rename(outputNameTemp, outputName, (renameError) => {
if (renameError) { if (renameError) {
throw new Error(`Could not rename output file "${outputNameTemp}": ${renameError.name}`); throw new Error(`Could not rename output file "${outputNameTemp}": ${renameError.message}`);
} }
}); });
} }