diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-11-15 21:29:54 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-11-15 21:29:54 -0400 |
commit | 381766efcdddb4c8706408a90c515470a6aa43a7 (patch) | |
tree | dda693b36724839ff2daff0e0766b7bdd883ea2c /Remote/Bup.hs | |
parent | 27fafd61c39f8436e19e8fd449b5851ead10bbd1 (diff) |
Avoid backtraces on expected failures when built with ghc 8; only use backtraces for unexpected errors.
ghc 8 added backtraces on uncaught errors. This is great, but git-annex was
using error in many places for a error message targeted at the user, in
some known problem case. A backtrace only confuses such a message, so omit it.
Notably, commands like git annex drop that failed due to eg, numcopies,
used to use error, so had a backtrace.
This commit was sponsored by Ethan Aubin.
Diffstat (limited to 'Remote/Bup.hs')
-rw-r--r-- | Remote/Bup.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Remote/Bup.hs b/Remote/Bup.hs index 22510859c..332e8d5dc 100644 --- a/Remote/Bup.hs +++ b/Remote/Bup.hs @@ -84,7 +84,7 @@ gen r u c gc = do (simplyPrepare $ checkKey r bupr') this where - buprepo = fromMaybe (error "missing buprepo") $ remoteAnnexBupRepo gc + buprepo = fromMaybe (giveup "missing buprepo") $ remoteAnnexBupRepo gc specialcfg = (specialRemoteCfg c) -- chunking would not improve bup { chunkConfig = NoChunks @@ -95,14 +95,14 @@ bupSetup mu _ c gc = do u <- maybe (liftIO genUUID) return mu -- verify configuration is sane - let buprepo = fromMaybe (error "Specify buprepo=") $ + let buprepo = fromMaybe (giveup "Specify buprepo=") $ M.lookup "buprepo" c (c', _encsetup) <- encryptionSetup c gc -- bup init will create the repository. -- (If the repository already exists, bup init again appears safe.) showAction "bup init" - unlessM (bup "init" buprepo []) $ error "bup init failed" + unlessM (bup "init" buprepo []) $ giveup "bup init failed" storeBupUUID u buprepo @@ -197,7 +197,7 @@ storeBupUUID u buprepo = do showAction "storing uuid" unlessM (onBupRemote r boolSystem "git" [Param "config", Param "annex.uuid", Param v]) $ - error "ssh failed" + giveup "ssh failed" else liftIO $ do r' <- Git.Config.read r let olduuid = Git.Config.get "annex.uuid" "" r' @@ -251,7 +251,7 @@ bup2GitRemote r | bupLocal r = if "/" `isPrefixOf` r then Git.Construct.fromAbsPath r - else error "please specify an absolute path" + else giveup "please specify an absolute path" | otherwise = Git.Construct.fromUrl $ "ssh://" ++ host ++ slash dir where bits = split ":" r |