unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.81k stars 271 forks source link

Summarize unexpected server responses #5342

Open hojberg opened 2 months ago

hojberg commented 2 months ago

When we hit an unexpected server response, summarize it with the status code, status message and the response body instead of dumping the raw Haskell data-structures.

This fixes https://github.com/unisonweb/unison/issues/5341 though I think we should probably log the actual request and response to a file somewhere.


Excuse my poor haskell here—this is more of a draft than anything, as I'm not sure what the appropriate style is.

aryairani commented 2 months ago

No worries about Haskell, but could you copy/paste or screenshot the new output for the review? (preferably before/after) or is it untested / hard to trigger?

aryairani commented 2 months ago

I think we should probably log the actual request and response to a file somewhere.

We can also stash the longer message in ucm and mention a debug command to display it.

ChrisPenner commented 2 months ago

My inclination would be to have add an UNISON_DEBUG env var flag for more details; that way we can easily ask users to re-run with more output enabled, and us devs can just always leave it enabled if we want.

Only downside would be if something isn't reproducible the message is lost, but if it's from a web-request I can always look up the logs to see what happened anyways 🤷🏼‍♂️

aryairani commented 2 months ago

An idea that came up in our standup was to display the request id and have the user report that, and then make @ChrisPenner look up ids on the server each time. 🙃