@@ -150,6 +150,7 @@ import Unison.Var (Var)
150
150
import Unison.Var qualified as Var
151
151
import Unison.WatchKind qualified as WK
152
152
import Witch (unsafeFrom )
153
+ import qualified Unison.Util.ColorText
153
154
154
155
reportBugURL :: Pretty
155
156
reportBugURL = " https://github.com/unisonweb/unison/issues/new"
@@ -1771,16 +1772,16 @@ notifyUser dir = \case
1771
1772
<> P. newline
1772
1773
<> P. indentN 2 (P. pshown response)
1773
1774
Servant. FailureResponse request response ->
1774
- P. wrap " Oops, I received an unexpected status code from the server. "
1775
+ unexpectedServerResponse response
1775
1776
<> P. newline
1776
1777
<> P. newline
1777
- <> P. wrap " Here is the request. "
1778
+ <> P. wrap " Here is the request: "
1778
1779
<> P. newline
1779
1780
<> P. newline
1780
1781
<> P. indentN 2 (P. pshown request)
1781
1782
<> P. newline
1782
1783
<> P. newline
1783
- <> P. wrap " Here is the full response. "
1784
+ <> P. wrap " Here is the full response: "
1784
1785
<> P. newline
1785
1786
<> P. newline
1786
1787
<> P. indentN 2 (P. pshown response)
@@ -2362,6 +2363,10 @@ prettyTransportError = \case
2362
2363
Share. RateLimitExceeded -> " Rate limit exceeded, please try again later."
2363
2364
Share. Timeout -> " The code server timed-out when responding to your request. Please try again later or report an issue if the problem persists."
2364
2365
Share. UnexpectedResponse resp ->
2366
+ unexpectedServerResponse resp
2367
+
2368
+ unexpectedServerResponse :: Servant. ResponseF LazyByteString. ByteString -> P. Pretty Unison.Util.ColorText. ColorText
2369
+ unexpectedServerResponse resp =
2365
2370
(P. lines . catMaybes)
2366
2371
[ Just
2367
2372
( " The server sent a "
@@ -2372,11 +2377,11 @@ prettyTransportError = \case
2372
2377
in if Text. null body then Nothing else Just (P. newline <> " Response body: " <> P. text body),
2373
2378
responseRequestId resp <&> \ responseId -> P. newline <> " Request ID: " <> P. blue (P. text responseId)
2374
2379
]
2375
- where
2376
- -- Dig the request id out of a response header.
2377
- responseRequestId :: Servant. Response -> Maybe Text
2378
- responseRequestId =
2379
- fmap Text. decodeUtf8 . List. lookup " X-RequestId" . Foldable. toList @ Seq . Servant. responseHeaders
2380
+
2381
+ -- | Dig the request id out of a response header.
2382
+ responseRequestId :: Servant. Response -> Maybe Text
2383
+ responseRequestId =
2384
+ fmap Text. decodeUtf8 . List. lookup " X-RequestId" . Foldable. toList @ Seq . Servant. responseHeaders
2380
2385
2381
2386
prettyEntityType :: Share. EntityType -> Pretty
2382
2387
prettyEntityType = \ case
0 commit comments