Skip to content

Commit 7fbacf7

Browse files
authored
Remove undefined with well defined result value
1 parent 568cca1 commit 7fbacf7

File tree

1 file changed

+6
-1
lines changed
  • src/Haskell/Ide/Engine/Plugin

1 file changed

+6
-1
lines changed

src/Haskell/Ide/Engine/Plugin/HaRe.hs

+6-1
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,13 @@ makeRefactorResult changedFiles = do
213213
diffOne (fp, newText) = do
214214
uri <- canonicalizeUri $ filePathToUri fp
215215
mvf <- getVirtualFile uri
216+
let resultFail = return $ IdeResultFail
217+
(IdeError PluginError
218+
(T.pack "makeRefactorResult: no access to the persisted file.")
219+
Null
220+
)
216221
origText <- case mvf of
217-
Nothing -> withMappedFile fp undefined $ liftIO . T.readFile
222+
Nothing -> withMappedFile fp resultFail $ liftIO . T.readFile
218223
Just vf -> pure (Rope.toText $ _text vf)
219224
-- TODO: remove this logging once we are sure we have a working solution
220225
logm $ "makeRefactorResult:groupedDiff = " ++ show (getGroupedDiff (lines $ T.unpack origText) (lines $ T.unpack newText))

0 commit comments

Comments
 (0)