rename errorid to message-id
authorJoey Hess <joeyh@joeyh.name>
Wed, 26 Apr 2023 16:53:30 +0000 (12:53 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 26 Apr 2023 16:53:30 +0000 (12:53 -0400)
Messages.hs
Messages/JSON.hs
Types/Messages.hs
doc/todo/api_for_telling_when_nonexistant_or_non_git_files_passed/comment_10_32ebb1ea1278b891b58dd3c4a8546453._comment [new file with mode: 0644]

index 78efd4873f39f93fa1268bc1acfff3805eb355e6..feb2fe4993787ae14ef5c9fec055f218a6008230 100644 (file)
@@ -27,7 +27,7 @@ module Messages (
        showEndFail,
        showEndResult,
        endResult,
-       ErrorId(..),
+       MessageId(..),
        toplevelFileProblem,
        toplevelWarning,
        warning,
@@ -203,10 +203,10 @@ endResult False = "failed"
 toplevelMsg :: StringContainingQuotedPath -> StringContainingQuotedPath
 toplevelMsg = ("git-annex: " <>)
 
-toplevelFileProblem :: Bool -> ErrorId -> StringContainingQuotedPath -> String -> RawFilePath -> Maybe Key -> SeekInput -> Annex ()
-toplevelFileProblem makeway errorid msg action file mkey si = do
+toplevelFileProblem :: Bool -> MessageId -> StringContainingQuotedPath -> String -> RawFilePath -> Maybe Key -> SeekInput -> Annex ()
+toplevelFileProblem makeway messageid msg action file mkey si = do
        maybeShowJSON' $ JSON.start action (Just file) mkey si
-       maybeShowJSON' $ JSON.errorid errorid
+       maybeShowJSON' $ JSON.messageid messageid
        warning' makeway id (toplevelMsg (QuotedPath file <> " " <> msg))
        maybeShowJSON' $ JSON.end False
 
index 9f569c09ea2f98b201c8734a2f15e4295a5fd6c4..eff5638fda8c03b1ec270cabe41204335e1d2b9c 100644 (file)
@@ -20,7 +20,7 @@ module Messages.JSON (
        addErrorMessage,
        note,
        info,
-       errorid,
+       messageid,
        add,
        complete,
        progress,
@@ -70,7 +70,7 @@ emit' b = do
        putMVar emitLock ()
 
 -- 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.
 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)
        combinelines new _old = new
 
-errorid :: ErrorId -> JSONBuilder
-errorid _ Nothing = Nothing
-errorid eid (Just (o, e)) = Just (HM.unionWith replaceold (HM.singleton "errorid" (toJSON' (show eid))) o, e)
+messageid :: MessageId -> JSONBuilder
+messageid _ Nothing = Nothing
+messageid mid (Just (o, e)) = Just (HM.unionWith replaceold (HM.singleton "message-id" (toJSON' (show mid))) o, e)
   where
        replaceold new _old = new
 
index 15cbfc2a7488d7034e0cb50771d63e9e1fa9eb87..3f830fc839f8c62bfb5ebc06c95e72024912de4e 100644 (file)
@@ -85,8 +85,8 @@ data SerializedOutputResponse
        = ReadyPrompt
        deriving (Eq, Show)
 
--- | Error identifiers. Avoid changing these.
-data ErrorId
+-- | Message identifiers. Avoid changing these.
+data MessageId
        = FileNotFound
        | FileBeyondSymbolicLink
        deriving (Show)
diff --git a/doc/todo/api_for_telling_when_nonexistant_or_non_git_files_passed/comment_10_32ebb1ea1278b891b58dd3c4a8546453._comment b/doc/todo/api_for_telling_when_nonexistant_or_non_git_files_passed/comment_10_32ebb1ea1278b891b58dd3c4a8546453._comment
new file mode 100644 (file)
index 0000000..1c4470e
--- /dev/null
@@ -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.
+"""]]