git-annex/Remote/Helper/Messages.hs
Joey Hess 0a4479b8ec
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.
2016-11-15 21:29:54 -04:00

35 lines
849 B
Haskell

{- git-annex remote messages
-
- Copyright 2013 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
module Remote.Helper.Messages where
import Annex.Common
import qualified Git
import qualified Types.Remote as Remote
class Describable a where
describe :: a -> String
instance Describable Git.Repo where
describe = Git.repoDescribe
instance Describable (Remote.RemoteA a) where
describe = Remote.name
instance Describable String where
describe = id
showChecking :: Describable a => a -> Annex ()
showChecking v = showAction $ "checking " ++ describe v
cantCheck :: Describable a => a -> e
cantCheck v = giveup $ "unable to check " ++ describe v
showLocking :: Describable a => a -> Annex ()
showLocking v = showAction $ "locking " ++ describe v