forked from commercialhaskell/stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStorage.hs
More file actions
55 lines (50 loc) · 1.84 KB
/
Copy pathStorage.hs
File metadata and controls
55 lines (50 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
-- | Types used by @Stack.Storage@ modules.
module Stack.Types.Storage
( StoragePrettyException (..)
) where
import Stack.Prelude
-- | Type representing \'pretty\' exceptions thrown by functions exported by
-- modules beginning @Stack.Storage@.
data StoragePrettyException
= StorageMigrationFailure !Text !(Path Abs File) !SomeException
deriving (Show, Typeable)
instance Pretty StoragePrettyException where
pretty (StorageMigrationFailure desc fp ex) =
"[S-8835]"
<> line
<> fillSep
[ flow "Stack could not migrate the the database"
, style File (fromString $ show desc)
, flow "located at"
, pretty fp
]
<> "."
<> blankLine
<> flow "While migrating the database, Stack encountered the error:"
<> blankLine
<> string exMsg
<> blankLine
<> fillSep
[ flow "Please report this as an issue at"
, style Url "https://github.com/commercialhaskell/stack/issues"
]
<> "."
<> blankLine
-- See https://github.com/commercialhaskell/stack/issues/5851
<> if exMsg == winIOGHCRTSMsg
then
flow "This error can be caused by a bug that arises if GHC's \
\'--io-manager=native' RTS option is set using the GHCRTS \
\environment variable. As a workaround try setting the option \
\in the project's Cabal file, Stack's YAML configuration file \
\or at the command line."
else
flow "As a workaround you may delete the database. This \
\will cause the database to be recreated."
where
exMsg = displayException ex
winIOGHCRTSMsg =
"\\\\.\\NUL: hDuplicateTo: illegal operation (handles are incompatible)"
instance Exception StoragePrettyException