Skip to content

Commit

Permalink
fix: show friendly error message when pull fails with EPERM (aws-ampl…
Browse files Browse the repository at this point in the history
…ify#7653)

* fix: show friendly error message when pull fails with EPERM
fix aws-amplify#7448

Co-authored-by: Colin Ihrig <[email protected]>
  • Loading branch information
2 people authored and akshbhu committed Aug 15, 2021
1 parent faf2e03 commit 233720d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/amplify-cli/src/attach-backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,16 @@ function backupAmplifyFolder() {

throw error;
}

fs.moveSync(amplifyDirPath, backupAmplifyDirPath);
try {
fs.moveSync(amplifyDirPath, backupAmplifyDirPath);
} catch (e) {
if (e.code === 'EPERM') {
throw new Error(
'Could not attach the backend to the project. Ensure that there are no applications locking the `amplify` folder and try again',
);
}
throw e;
}
}
}

Expand Down

0 comments on commit 233720d

Please sign in to comment.