@@ -70,12 +70,31 @@ data CabalException
70
70
| PkgDumpFailed
71
71
| FailedToParseOutput
72
72
| CantFindSourceModule ModuleName
73
- | VersionMisMatch FilePath Version FilePath Version
74
- | VersionMisMatchGHC FilePath Version FilePath Version
73
+ | VersionMismatchJS FilePath Version FilePath Version
74
+ | VersionMismatchGHCJS FilePath Version FilePath Version
75
75
| GlobalPackageDBLimitation
76
76
| GlobalPackageDBSpecifiedFirst
77
77
| MatchDirFileGlob String
78
78
| MatchDirFileGlobErrors [String ]
79
+ | ErrorParsingFileDoesntExist FilePath
80
+ | FailedParsing String
81
+ | NotFoundMsg
82
+ | UnrecognisedBuildTarget [String ]
83
+ | ReportBuildTargetProblems [(String , [String ], String )]
84
+ | UnknownBuildTarget [(String , [(String , String )])]
85
+ | AmbiguousBuildTarget [(String , [(String , String )])]
86
+ | CheckBuildTargets String
87
+ | VersionMismatchGHC FilePath Version FilePath Version
88
+ | CheckPackageDbStackPost76
89
+ | CheckPackageDbStackPre76
90
+ | GlobalPackageDbSpecifiedFirst
91
+ | CantInstallForeignLib
92
+ | NoSupportForPreProcessingTest TestType
93
+ | NoSupportForPreProcessingBenchmark BenchmarkType
94
+ | CantFindSourceForPreProcessFile String
95
+ | NoSupportPreProcessingTestExtras TestType
96
+ | NoSupportPreProcessingBenchmarkExtras BenchmarkType
97
+ | UnlitException String
79
98
deriving (Show , Typeable )
80
99
81
100
exceptionCode :: CabalException -> Int
@@ -120,12 +139,31 @@ exceptionCode e = case e of
120
139
PkgDumpFailed {} -> 2290
121
140
FailedToParseOutput {} -> 5500
122
141
CantFindSourceModule {} -> 8870
123
- VersionMisMatch {} -> 9001
124
- VersionMisMatchGHC {} -> 4001
142
+ VersionMismatchJS {} -> 9001
143
+ VersionMismatchGHCJS {} -> 4001
125
144
GlobalPackageDBLimitation {} -> 5002
126
145
GlobalPackageDBSpecifiedFirst {} -> 3901
127
146
MatchDirFileGlob {} -> 9760
128
147
MatchDirFileGlobErrors {} -> 6661
148
+ ErrorParsingFileDoesntExist {} -> 1234
149
+ FailedParsing {} -> 6565
150
+ NotFoundMsg {} -> 8011
151
+ UnrecognisedBuildTarget {} -> 3410
152
+ ReportBuildTargetProblems {} -> 5504
153
+ UnknownBuildTarget {} -> 4444
154
+ AmbiguousBuildTarget {} -> 7865
155
+ CheckBuildTargets {} -> 4733
156
+ VersionMismatchGHC {} -> 4000
157
+ CheckPackageDbStackPost76 {} -> 3000
158
+ CheckPackageDbStackPre76 {} -> 5640
159
+ GlobalPackageDbSpecifiedFirst {} -> 2345
160
+ CantInstallForeignLib {} -> 8221
161
+ NoSupportForPreProcessingTest {} -> 3008
162
+ NoSupportForPreProcessingBenchmark {} -> 6990
163
+ CantFindSourceForPreProcessFile {} -> 7554
164
+ NoSupportPreProcessingTestExtras {} -> 7886
165
+ NoSupportPreProcessingBenchmarkExtras {} -> 9999
166
+ UnlitException {} -> 5454
129
167
130
168
exceptionMessage :: CabalException -> String
131
169
exceptionMessage e = case e of
@@ -186,7 +224,7 @@ exceptionMessage e = case e of
186
224
PkgDumpFailed -> " pkg dump failed"
187
225
FailedToParseOutput -> " failed to parse output of 'pkg dump'"
188
226
CantFindSourceModule moduleName -> " can't find source for module " ++ prettyShow moduleName
189
- VersionMisMatch ghcjsProgPath ghcjsVersion ghcjsPkgProgPath ghcjsPkgGhcjsVersion ->
227
+ VersionMismatchJS ghcjsProgPath ghcjsVersion ghcjsPkgProgPath ghcjsPkgGhcjsVersion ->
190
228
" Version mismatch between ghcjs and ghcjs-pkg: "
191
229
++ show ghcjsProgPath
192
230
++ " is version "
@@ -195,7 +233,7 @@ exceptionMessage e = case e of
195
233
++ show ghcjsPkgProgPath
196
234
++ " is version "
197
235
++ prettyShow ghcjsPkgGhcjsVersion
198
- VersionMisMatchGHC ghcjsProgPath ghcjsGhcVersion ghcjsPkgProgPath ghcjsPkgVersion ->
236
+ VersionMismatchGHCJS ghcjsProgPath ghcjsGhcVersion ghcjsPkgProgPath ghcjsPkgVersion ->
199
237
" Version mismatch between ghcjs and ghcjs-pkg: "
200
238
++ show ghcjsProgPath
201
239
++ " was built with GHC version "
@@ -213,3 +251,105 @@ exceptionMessage e = case e of
213
251
++ " specified first and cannot be specified multiple times"
214
252
MatchDirFileGlob pathError -> pathError
215
253
MatchDirFileGlobErrors errors -> unlines errors
254
+ ErrorParsingFileDoesntExist filePath -> " Error Parsing: file \" " ++ filePath ++ " \" doesn't exist. Cannot continue."
255
+ FailedParsing name -> " Failed parsing \" " ++ name ++ " \" ."
256
+ NotFoundMsg ->
257
+ " The package has a './configure' script. "
258
+ ++ " If you are on Windows, This requires a "
259
+ ++ " Unix compatibility toolchain such as MinGW+MSYS or Cygwin. "
260
+ ++ " If you are not on Windows, ensure that an 'sh' command "
261
+ ++ " is discoverable in your path."
262
+ UnrecognisedBuildTarget target ->
263
+ unlines
264
+ [ " Unrecognised build target '" ++ name ++ " '."
265
+ | name <- target
266
+ ]
267
+ ++ " Examples:\n "
268
+ ++ " - build foo -- component name "
269
+ ++ " (library, executable, test-suite or benchmark)\n "
270
+ ++ " - build Data.Foo -- module name\n "
271
+ ++ " - build Data/Foo.hsc -- file name\n "
272
+ ++ " - build lib:foo exe:foo -- component qualified by kind\n "
273
+ ++ " - build foo:Data.Foo -- module qualified by component\n "
274
+ ++ " - build foo:Data/Foo.hsc -- file qualified by component"
275
+ ReportBuildTargetProblems targets ->
276
+ unlines
277
+ [ " Unrecognised build target '"
278
+ ++ target
279
+ ++ " '.\n "
280
+ ++ " Expected a "
281
+ ++ intercalate " or " expected
282
+ ++ " , rather than '"
283
+ ++ got
284
+ ++ " '."
285
+ | (target, expected, got) <- targets
286
+ ]
287
+ UnknownBuildTarget targets ->
288
+ unlines
289
+ [ " Unknown build target '"
290
+ ++ target
291
+ ++ " '.\n There is no "
292
+ ++ intercalate
293
+ " or "
294
+ [ mungeThing thing ++ " '" ++ got ++ " '"
295
+ | (thing, got) <- nosuch
296
+ ]
297
+ ++ " ."
298
+ | (target, nosuch) <- targets
299
+ ]
300
+ where
301
+ mungeThing " file" = " file target"
302
+ mungeThing thing = thing
303
+ AmbiguousBuildTarget targets ->
304
+ unlines
305
+ [ " Ambiguous build target '"
306
+ ++ target
307
+ ++ " '. It could be:\n "
308
+ ++ unlines
309
+ [ " "
310
+ ++ ut
311
+ ++ " ("
312
+ ++ bt
313
+ ++ " )"
314
+ | (ut, bt) <- amb
315
+ ]
316
+ | (target, amb) <- targets
317
+ ]
318
+ CheckBuildTargets errorStr -> errorStr
319
+ VersionMismatchGHC ghcProgPath ghcVersion ghcPkgProgPath ghcPkgVersion ->
320
+ " Version mismatch between ghc and ghc-pkg: "
321
+ ++ ghcProgPath
322
+ ++ " is version "
323
+ ++ prettyShow ghcVersion
324
+ ++ " "
325
+ ++ ghcPkgProgPath
326
+ ++ " is version "
327
+ ++ prettyShow ghcPkgVersion
328
+ CheckPackageDbStackPost76 ->
329
+ " If the global package db is specified, it must be "
330
+ ++ " specified first and cannot be specified multiple times"
331
+ CheckPackageDbStackPre76 ->
332
+ " With current ghc versions the global package db is always used "
333
+ ++ " and must be listed first. This ghc limitation is lifted in GHC 7.6,"
334
+ ++ " see https://gitlab.haskell.org/ghc/ghc/-/issues/5977"
335
+ GlobalPackageDbSpecifiedFirst ->
336
+ " If the global package db is specified, it must be "
337
+ ++ " specified first and cannot be specified multiple times"
338
+ CantInstallForeignLib -> " Can't install foreign-library symlink on non-Linux OS"
339
+ NoSupportForPreProcessingTest tt ->
340
+ " No support for preprocessing test "
341
+ ++ " suite type "
342
+ ++ prettyShow tt
343
+ NoSupportForPreProcessingBenchmark tt ->
344
+ " No support for preprocessing benchmark "
345
+ ++ " type "
346
+ ++ prettyShow tt
347
+ CantFindSourceForPreProcessFile errorStr -> errorStr
348
+ NoSupportPreProcessingTestExtras tt ->
349
+ " No support for preprocessing test suite type "
350
+ ++ prettyShow tt
351
+ NoSupportPreProcessingBenchmarkExtras tt ->
352
+ " No support for preprocessing benchmark "
353
+ ++ " type "
354
+ ++ prettyShow tt
355
+ UnlitException str -> str
0 commit comments