git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #1627 from hdgarrood/psc-publish-error-reporting
81a7efaPhil Freeman
src/Language/PureScript/Publish.hs+1−1
@@ -122,7 +122,7 @@ preparePackage' opts = do
122 requireCleanWorkingTree
122 requireCleanWorkingTree
123
123
124 pkgMeta <- liftIO (Bower.decodeFile "bower.json")
124 pkgMeta <- liftIO (Bower.decodeFile "bower.json")
125− >>= flip catchLeft (userError . CouldntParseBowerJSON)
125+ >>= flip catchLeft (userError . CouldntDecodeBowerJSON)
126 (pkgVersionTag, pkgVersion) <- publishGetVersion opts
126 (pkgVersionTag, pkgVersion) <- publishGetVersion opts
127 pkgGithub <- getBowerInfo pkgMeta
127 pkgGithub <- getBowerInfo pkgMeta
128 (pkgBookmarks, pkgModules) <- getModulesAndBookmarks
128 (pkgBookmarks, pkgModules) <- getModulesAndBookmarks
src/Language/PureScript/Publish/ErrorsWarnings.hs+7−17
@@ -29,7 +29,7 @@ import qualified Data.List.NonEmpty as NonEmpty
29import qualified Data.Text as T
29import qualified Data.Text as T
30
30
31import Control.Exception (IOException)
31import Control.Exception (IOException)
32−import Web.Bower.PackageMeta (BowerError, PackageName, runPackageName)
32+import Web.Bower.PackageMeta (BowerError, PackageName, runPackageName, showBowerError)
33import qualified Web.Bower.PackageMeta as Bower
33import qualified Web.Bower.PackageMeta as Bower
34
34
35import qualified Language.PureScript as P
35import qualified Language.PureScript as P
@@ -55,8 +55,7 @@ data PackageWarning
55data UserError
55data UserError
56 = BowerJSONNotFound
56 = BowerJSONNotFound
57 | BowerExecutableNotFound [String] -- list of executable names tried
57 | BowerExecutableNotFound [String] -- list of executable names tried
58− | CouldntParseBowerJSON (ParseError BowerError)
58+ | CouldntDecodeBowerJSON (ParseError BowerError)
59− | BowerJSONNameMissing
60 | TagMustBeCheckedOut
59 | TagMustBeCheckedOut
61 | AmbiguousVersions [Version] -- Invariant: should contain at least two elements
60 | AmbiguousVersions [Version] -- Invariant: should contain at least two elements
62 | BadRepositoryField RepositoryFieldError
61 | BadRepositoryField RepositoryFieldError
@@ -130,21 +129,12 @@ displayUserError e = case e of
130 ])
129 ])
131 where
130 where
132 format = intercalate ", " . map show
131 format = intercalate ", " . map show
133− CouldntParseBowerJSON err ->
132+ CouldntDecodeBowerJSON err ->
134 vcat
133 vcat
135− [ successivelyIndented
134+ [ para "There was a problem with your bower.json file:"
136− [ "The bower.json file could not be parsed as JSON:"
135+ , indented (vcat (map (para . T.unpack) (displayError showBowerError err)))
137− , "aeson reported: " ++ show err
136+ , spacer
138− ]
139− , para "Please ensure that your bower.json file is valid JSON."
137+ , para "Please ensure that your bower.json file is valid."
140− ]
141− BowerJSONNameMissing ->
142− vcat
143− [ successivelyIndented
144− [ "In bower.json:"
145− , "the \"name\" key was not found."
146− ]
147− , para "Please give your package a name first."
148 ]
138 ]
149 TagMustBeCheckedOut ->
139 TagMustBeCheckedOut ->
150 vcat
140 vcat