githash 0.1.2.0 → 0.1.3.0
raw patch · 3 files changed
+14/−6 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- GitHash: instance GHC.Exception.Exception GitHash.GitHashException
+ GitHash: GHEGitRunException :: !FilePath -> ![String] -> !IOException -> GitHashException
+ GitHash: instance GHC.Exception.Type.Exception GitHash.GitHashException
Files
- ChangeLog.md +6/−0
- githash.cabal +2/−2
- src/GitHash.hs +6/−4
ChangeLog.md view
@@ -1,5 +1,11 @@ # ChangeLog for githash +## 0.1.3.0++* Catch exceptions thrown by `readCreateProcessWithExitCode` to deal+ with missing `git` executable+ [#7](https://github.com/snoyberg/githash/issues/7)+ ## 0.1.2.0 * Add `tGitInfoTry` and `tGitInfoCwdTry`
githash.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 2b87276bb2ac5b00efe63f26346081485fe2d35e29770fcceb6fa7ab6f1fd414+-- hash: 2d1ac1215ae90e4ef0ec7e8b32fb6fae19439ce136c6f063598c703167993f92 name: githash-version: 0.1.2.0+version: 0.1.3.0 synopsis: Compile git revision info into Haskell projects description: Please see the README and documentation at <https://www.stackage.org/package/githash> category: Development
src/GitHash.hs view
@@ -183,10 +183,11 @@ runGit root args = do let cp = (proc "git" args) { cwd = Just root }- (ec, out, err) <- readCreateProcessWithExitCode cp ""- case ec of- ExitSuccess -> return $ Right out- ExitFailure _ -> return $ Left $ GHEGitRunFailed root args ec out err+ eres <- try $ readCreateProcessWithExitCode cp ""+ return $ case eres of+ Left e -> Left $ GHEGitRunException root args e+ Right (ExitSuccess, out, _) -> Right out+ Right (ec@ExitFailure{}, out, err) -> Left $ GHEGitRunFailed root args ec out err -- | Exceptions which can occur when using this library's functions. --@@ -195,6 +196,7 @@ = GHECouldn'tReadFile !FilePath !IOException | GHEInvalidCommitCount !FilePath !String | GHEGitRunFailed !FilePath ![String] !ExitCode !String !String+ | GHEGitRunException !FilePath ![String] !IOException deriving (Show, Eq, Typeable) instance Exception GitHashException