make storeKey throw exceptions
When storing content on remote fails, always display a reason why. Since the Storer used by special remotes already did, this mostly affects git remotes, but not entirely. For example, if git-lfs failed to connect to the endpoint, it used to silently return False.
This commit is contained in:
parent
b50ee9cd0c
commit
c1cd402081
34 changed files with 214 additions and 197 deletions
|
@ -147,7 +147,7 @@ checkNonEmpty k
|
|||
giveup "Cannot store empty files in Glacier."
|
||||
| otherwise = return ()
|
||||
|
||||
store' :: Remote -> Key -> L.ByteString -> MeterUpdate -> Annex Bool
|
||||
store' :: Remote -> Key -> L.ByteString -> MeterUpdate -> Annex ()
|
||||
store' r k b p = go =<< glacierEnv c gc u
|
||||
where
|
||||
c = config r
|
||||
|
@ -160,13 +160,11 @@ store' r k b p = go =<< glacierEnv c gc u
|
|||
, Param $ getVault $ config r
|
||||
, Param "-"
|
||||
]
|
||||
go Nothing = return False
|
||||
go (Just e) = do
|
||||
go Nothing = giveup "Glacier not usable."
|
||||
go (Just e) = liftIO $ do
|
||||
let cmd = (proc "glacier" (toCommand params)) { env = Just e }
|
||||
liftIO $ catchBoolIO $
|
||||
withHandle StdinHandle createProcessSuccess cmd $ \h -> do
|
||||
meteredWrite p h b
|
||||
return True
|
||||
withHandle StdinHandle createProcessSuccess cmd $ \h ->
|
||||
meteredWrite p h b
|
||||
|
||||
retrieve :: Remote -> Retriever
|
||||
retrieve = byteRetriever . retrieve'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue