execution-fault-fragment.hs (1151B)
1 -- abortIO formats scoped effect diagnostics with receiver and return-path 2 -- attribution before passing the failure to the execution runner. 3 executionFaultMessage :: T -> Maybe String 4 executionFaultMessage (Fork tag diagnostic) 5 | tag == ofString "scp-execution-fault.v1" = Just $ case diagnostic of 6 Fork kind (Fork detail (Fork location returns)) -> 7 "execution fault [" ++ text kind ++ "]: " ++ text detail 8 ++ " at " ++ site location ++ path returns 9 _ -> "malformed execution fault: " ++ formatT Decode diagnostic 10 where 11 text value = either (const $ formatT Decode value) id (toString value) 12 site (Fork entry receiver) = text entry ++ "/" ++ text receiver 13 site value = text value 14 path Leaf = "" 15 path values = "; returns " ++ joinSites values 16 joinSites (Fork location Leaf) = returnSite location 17 joinSites (Fork location rest) = returnSite location ++ " <- " ++ joinSites rest 18 joinSites value = text value 19 returnSite (Fork entry (Fork helper receiver)) = 20 site (Fork entry receiver) ++ " via " ++ text helper 21 returnSite value = text value 22 executionFaultMessage _ = Nothing