Skip to content

Commit 923b327

Browse files
committed
improve UnacceptableCommit
1 parent 6603873 commit 923b327

File tree

1 file changed

+5
-5
lines changed
  • cli/src/Oracle/Validate/Requests/TestRun

1 file changed

+5
-5
lines changed

cli/src/Oracle/Validate/Requests/TestRun/Create.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Oracle.Validate.Requests.TestRun.Create
99

1010
import Control.Monad (when)
1111
import Control.Monad.Trans.Class (lift)
12-
import Core.Types.Basic (Directory (..), Duration (..), Try (..))
12+
import Core.Types.Basic (Commit, Directory (..), Duration (..), Repository, Try (..))
1313
import Core.Types.Change (Change (..), Key (..))
1414
import Core.Types.Fact (Fact (..))
1515
import Core.Types.Operation (Op (..), Operation (..))
@@ -105,7 +105,7 @@ validateCreateTestRun
105105

106106
data TestRunRejection
107107
= UnacceptableDuration Int Int
108-
| UnacceptableCommit
108+
| UnacceptableCommit Repository Commit
109109
| UnacceptableTryIndex
110110
| UnacceptableRole
111111
| NoRegisteredKeyVerifiesTheSignature
@@ -119,8 +119,8 @@ data TestRunRejection
119119
instance Monad m => ToJSON m TestRunRejection where
120120
toJSON (UnacceptableDuration minDuration maxDuration) =
121121
stringJSON $ "unacceptable duration. Expecting duration to be between "<> show minDuration <> " and "<>show maxDuration
122-
toJSON UnacceptableCommit =
123-
stringJSON "unacceptable commit"
122+
toJSON (UnacceptableCommit repo commit)=
123+
stringJSON $ "unacceptable commit. The specified commit "<> show commit<>" cannot be found in the repository "<>show repo
124124
toJSON UnacceptableTryIndex =
125125
stringJSON "unacceptable try index"
126126
toJSON UnacceptableRole =
@@ -210,7 +210,7 @@ checkCommit
210210
Right exists ->
211211
if exists
212212
then Nothing
213-
else Just UnacceptableCommit
213+
else Just (UnacceptableCommit testRun.repository (commitId testRun))
214214

215215
checkSignature
216216
:: Monad m

0 commit comments

Comments
 (0)