Skip to content

Improve error message when receiving unexpected server responses #5341

Open
@hojberg

Description

Note, that while this example shows a specific command that could have a dedicated error message, this suggested ticket is about improving the unexpected server response message generally.

What's the message you're seeing?
Please paste from your terminal or paste a screenshot, e.g:

focus/main> lib.install potions

  Oops, I received an unexpected status code from the server.

  Here is the request.

    Request
        { requestPath =
            ( BaseUrl
                { baseUrlScheme = Https
                , baseUrlHost = "api.unison-lang.org"
                , baseUrlPort = 443
                , baseUrlPath = ""
                }
            , "/ucm/v1/projects/project"
            )
        , requestQueryString = fromList
            [
                ( "name"
                , Just "potions"
                )
            ]
        , requestBody = Nothing
        , requestAccept = fromList
            [ application/json;charset=utf-8
            , application/json
            ]
        , requestHeaders = fromList []
        , requestHttpVersion = HTTP/1.1
        , requestMethod = "GET"
        }

  Here is the full response.

    Response
        { responseStatusCode = Status
            { statusCode = 400
            , statusMessage = "Invalid Parameter"
            }
        , responseHeaders = fromList
            [
                ( "Server"
                , "nginx/1.24.0"
                )
            ,
                ( "Date"

What would a better version look like?

Sorry, I wasn't able to perform `lib.install`:

  The server (share.unison-lang.org) responded 
  unexpectedly with: 
    400, Invalid Parameter

Metadata

Assignees

No one assigned

    Labels

    error-messageRequest for improved error message

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions