rename errorid to message-id
This commit is contained in:
parent
b43da83a67
commit
4881bc5a53
4 changed files with 19 additions and 11 deletions
|
@ -27,7 +27,7 @@ module Messages (
|
||||||
showEndFail,
|
showEndFail,
|
||||||
showEndResult,
|
showEndResult,
|
||||||
endResult,
|
endResult,
|
||||||
ErrorId(..),
|
MessageId(..),
|
||||||
toplevelFileProblem,
|
toplevelFileProblem,
|
||||||
toplevelWarning,
|
toplevelWarning,
|
||||||
warning,
|
warning,
|
||||||
|
@ -203,10 +203,10 @@ endResult False = "failed"
|
||||||
toplevelMsg :: StringContainingQuotedPath -> StringContainingQuotedPath
|
toplevelMsg :: StringContainingQuotedPath -> StringContainingQuotedPath
|
||||||
toplevelMsg = ("git-annex: " <>)
|
toplevelMsg = ("git-annex: " <>)
|
||||||
|
|
||||||
toplevelFileProblem :: Bool -> ErrorId -> StringContainingQuotedPath -> String -> RawFilePath -> Maybe Key -> SeekInput -> Annex ()
|
toplevelFileProblem :: Bool -> MessageId -> StringContainingQuotedPath -> String -> RawFilePath -> Maybe Key -> SeekInput -> Annex ()
|
||||||
toplevelFileProblem makeway errorid msg action file mkey si = do
|
toplevelFileProblem makeway messageid msg action file mkey si = do
|
||||||
maybeShowJSON' $ JSON.start action (Just file) mkey si
|
maybeShowJSON' $ JSON.start action (Just file) mkey si
|
||||||
maybeShowJSON' $ JSON.errorid errorid
|
maybeShowJSON' $ JSON.messageid messageid
|
||||||
warning' makeway id (toplevelMsg (QuotedPath file <> " " <> msg))
|
warning' makeway id (toplevelMsg (QuotedPath file <> " " <> msg))
|
||||||
maybeShowJSON' $ JSON.end False
|
maybeShowJSON' $ JSON.end False
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ module Messages.JSON (
|
||||||
addErrorMessage,
|
addErrorMessage,
|
||||||
note,
|
note,
|
||||||
info,
|
info,
|
||||||
errorid,
|
messageid,
|
||||||
add,
|
add,
|
||||||
complete,
|
complete,
|
||||||
progress,
|
progress,
|
||||||
|
@ -70,7 +70,7 @@ emit' b = do
|
||||||
putMVar emitLock ()
|
putMVar emitLock ()
|
||||||
|
|
||||||
-- Building up a JSON object can be done by first using start,
|
-- Building up a JSON object can be done by first using start,
|
||||||
-- then add and note and errorid any number of times, and finally
|
-- then add and note and messageid any number of times, and finally
|
||||||
-- complete.
|
-- complete.
|
||||||
type JSONBuilder = Maybe (Object, Bool) -> Maybe (Object, Bool)
|
type JSONBuilder = Maybe (Object, Bool) -> Maybe (Object, Bool)
|
||||||
|
|
||||||
|
@ -115,9 +115,9 @@ note s (Just (o, e)) = Just (HM.unionWith combinelines (HM.singleton "note" (toJ
|
||||||
String (old <> "\n" <> new)
|
String (old <> "\n" <> new)
|
||||||
combinelines new _old = new
|
combinelines new _old = new
|
||||||
|
|
||||||
errorid :: ErrorId -> JSONBuilder
|
messageid :: MessageId -> JSONBuilder
|
||||||
errorid _ Nothing = Nothing
|
messageid _ Nothing = Nothing
|
||||||
errorid eid (Just (o, e)) = Just (HM.unionWith replaceold (HM.singleton "errorid" (toJSON' (show eid))) o, e)
|
messageid mid (Just (o, e)) = Just (HM.unionWith replaceold (HM.singleton "message-id" (toJSON' (show mid))) o, e)
|
||||||
where
|
where
|
||||||
replaceold new _old = new
|
replaceold new _old = new
|
||||||
|
|
||||||
|
|
|
@ -85,8 +85,8 @@ data SerializedOutputResponse
|
||||||
= ReadyPrompt
|
= ReadyPrompt
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
-- | Error identifiers. Avoid changing these.
|
-- | Message identifiers. Avoid changing these.
|
||||||
data ErrorId
|
data MessageId
|
||||||
= FileNotFound
|
= FileNotFound
|
||||||
| FileBeyondSymbolicLink
|
| FileBeyondSymbolicLink
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 10"""
|
||||||
|
date="2023-04-26T16:42:24Z"
|
||||||
|
content="""
|
||||||
|
I decided to rename it "message-id" since it could go on warning or other
|
||||||
|
messages too conceivably.
|
||||||
|
"""]]
|
Loading…
Reference in a new issue