From ce6fb0bb1ef4fee7396a76eaa0a05695504ce6e3 Mon Sep 17 00:00:00 2001 From: Arjun Kathuria Date: Wed, 11 Aug 2021 10:28:30 +0530 Subject: [PATCH] Adds new Error type `FileAlreadyExistsError` --- lib/GHCup/Errors.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/GHCup/Errors.hs b/lib/GHCup/Errors.hs index 30d59e0..491a6d4 100644 --- a/lib/GHCup/Errors.hs +++ b/lib/GHCup/Errors.hs @@ -176,6 +176,16 @@ instance Pretty FileDoesNotExistError where pPrint (FileDoesNotExistError file) = text [i|File "#{file}" does not exist.|] +-- | The file already exists +-- (e.g. when we use isolated installs with the same path). +-- (e.g. This is done to prevent any overwriting) +data FileAlreadyExistsError = FileAlreadyExistsError FilePath + deriving Show + +instance Pretty FileAlreadyExistsError where + pPrint (FileAlreadyExistsError file) = + text [i|File "#{file}" Already exists.|] + data TarDirDoesNotExist = TarDirDoesNotExist TarDir deriving Show