Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib.install on invalid project gives a bad error #5334

Open
ChrisPenner opened this issue Sep 6, 2024 · 4 comments
Open

lib.install on invalid project gives a bad error #5334

ChrisPenner opened this issue Sep 6, 2024 · 4 comments
Labels
error-message Request for improved error message

Comments

@ChrisPenner
Copy link
Contributor

If you don't specify a valid project name you get a request dump :'(

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"
@ChrisPenner ChrisPenner added the error-message Request for improved error message label Sep 6, 2024
@hojberg
Copy link
Member

hojberg commented Sep 11, 2024

this is related to #5205

@hojberg
Copy link
Member

hojberg commented Sep 11, 2024

Here's a ProjectRef type and parser from the Share UI: https://github.com/unisoncomputing/share-ui/blob/main/src/UnisonShare/Project/ProjectRef.elm

We should check if its valid based in the above before sending the request

@hojberg
Copy link
Member

hojberg commented Sep 11, 2024

Here's a ticket for generally improving unexpected server response errors: #5341

@hojberg
Copy link
Member

hojberg commented Sep 11, 2024

Suggested error message surrounding project reference parsing:

`potions` looks like an invalid project reference. 
Please try again in the format of: @unison/base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error-message Request for improved error message
Projects
None yet
Development

No branches or pull requests

2 participants