@@ -9,7 +9,7 @@ module Oracle.Validate.Requests.TestRun.Create
9
9
10
10
import Control.Monad (when )
11
11
import Control.Monad.Trans.Class (lift )
12
- import Core.Types.Basic (Directory (.. ), Duration (.. ), Try (.. ))
12
+ import Core.Types.Basic (Commit , Directory (.. ), Duration (.. ), Repository , Try (.. ))
13
13
import Core.Types.Change (Change (.. ), Key (.. ))
14
14
import Core.Types.Fact (Fact (.. ))
15
15
import Core.Types.Operation (Op (.. ), Operation (.. ))
@@ -105,7 +105,7 @@ validateCreateTestRun
105
105
106
106
data TestRunRejection
107
107
= UnacceptableDuration Int Int
108
- | UnacceptableCommit
108
+ | UnacceptableCommit Repository Commit
109
109
| UnacceptableTryIndex
110
110
| UnacceptableRole
111
111
| NoRegisteredKeyVerifiesTheSignature
@@ -119,8 +119,8 @@ data TestRunRejection
119
119
instance Monad m => ToJSON m TestRunRejection where
120
120
toJSON (UnacceptableDuration minDuration maxDuration) =
121
121
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
124
124
toJSON UnacceptableTryIndex =
125
125
stringJSON " unacceptable try index"
126
126
toJSON UnacceptableRole =
@@ -210,7 +210,7 @@ checkCommit
210
210
Right exists ->
211
211
if exists
212
212
then Nothing
213
- else Just UnacceptableCommit
213
+ else Just ( UnacceptableCommit testRun . repository (commitId testRun))
214
214
215
215
checkSignature
216
216
:: Monad m
0 commit comments