cli: Add better error message if a patch failed
Signed-off-by: Marcus Eide <eide@spotify.com>
This commit is contained in:
committed by
Philipp Hugenroth
parent
c07c3b7364
commit
284810a0a1
@@ -32,6 +32,12 @@ export const patch = async (patchFile: string) => {
|
||||
const targetFile = path.join(targetRoot, targetName);
|
||||
const oldContent = await fs.readFile(targetFile, 'utf8');
|
||||
const newContent = differ.applyPatch(oldContent, patchContent);
|
||||
if (!newContent) {
|
||||
throw new Error(
|
||||
`Patch ${patchFile} was not applied correctly.
|
||||
Did you change ${targetName} manually before running this command?`,
|
||||
);
|
||||
}
|
||||
|
||||
return await fs.writeFile(targetFile, newContent, 'utf8');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user