Skip to content

Commit 3cbe970

Browse files
authored
Merge pull request #1445 from digitallyinduced/s0kil/fix-issue-1435
Throw Exceptions When Trying To Save A File
2 parents 0f76252 + dd821df commit 3cbe970

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

IHP/FileStorage/ControllerFunctions.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,18 @@ storeFileWithOptions fileInfo options = do
115115

116116
let contentType = cs (Wai.fileContentType fileInfo)
117117
contentDisposition <- (get #contentDisposition options) fileInfo
118-
runMinio connectInfo do
118+
trySaveFile <- runMinio connectInfo do
119119
let options :: PutObjectOptions = defaultPutObjectOptions { pooContentType = Just contentType, pooContentDisposition = contentDisposition }
120120
putObject bucket objectPath payload Nothing options
121+
case trySaveFile of
122+
Left e -> throw e
123+
Right _ -> pure ()
121124

122125
pure $ baseUrl <> objectPath
123126

124127
pure StoredFile { path = objectPath, url }
125128

126-
-- | Fetchs an url and uploads it to the storage.
129+
-- | Fetches an url and uploads it to the storage.
127130
--
128131
-- The stored file has the content type provided by @Content-Type@ header of the downloaded file.
129132
--

0 commit comments

Comments
 (0)