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

Specifying non-existing resolver results in StatusCodeException (404) #434

Closed
zudov opened this issue Jun 27, 2015 · 5 comments · Fixed by #436
Closed

Specifying non-existing resolver results in StatusCodeException (404) #434

zudov opened this issue Jun 27, 2015 · 5 comments · Fixed by #436

Comments

@zudov
Copy link
Contributor

zudov commented Jun 27, 2015

Steps to reproduce:

  1. put - resolver: 42.0 in stack.yaml
  2. run stack build

Output:

2015-06-27 13:45:47.528651: [debug] Downloading build plan from: https://raw.githubusercontent.com/fpco/lts-haskell/master/lts-42.0.yaml @(stack_A9qpSwIoAUk1jSor4vUA5i:Stack.BuildPlan src/Stack/BuildPlan.hs:464:13)
Downloading lts-42.0 build plan ...StatusCodeException (Status {statusCode = 404, statusMessage = "Not Found"}) [("Content-Security-Policy","default-src 'none'"),("X-XSS-Protection","1; mode=block"),("X-Frame-Options","deny"),("X-Content-Type-Options","nosniff"),("Strict-Transport-Security","max-age=31536000"),("Content-Length","9"),("Accept-Ranges","bytes"),("Date","Sat, 27 Jun 2015 13:46:13 GMT"),("Via","1.1 varnish"),("Connection","keep-alive"),("X-Served-By","cache-fra1224-FRA"),("X-Cache","MISS"),("X-Cache-Hits","0"),("Vary","Authorization,Accept-Encoding"),("Access-Control-Allow-Origin","*"),("Expires","Sat, 27 Jun 2015 13:51:13 GMT"),("Source-Age","0"),("X-Response-Body-Start","Not Found"),("X-Request-URL","GET https://raw.githubusercontent.com:443/fpco/lts-haskell/master/lts-42.0.yaml")] (CJ {expose = []})

I think it would be better if more user-friendly error message was displayed. Something like:

Non-existing resolver specified: lts-42.

Do we need such improvement?

@chrisdone
Copy link
Member

That would be nice!

@zudov
Copy link
Contributor Author

zudov commented Jun 27, 2015

@chrisdone, I would like to hack on this.

The failure lies in Stack.BuildPlan.loadBuildPlan:

            $logDebug $ "Downloading build plan from: " <> url
            _ <- download req fp

I guess simply catching the exception and displaying error message would be good enough.
I've also been thinking about adding something like download404 :: _ -> _ -> _ (Maybe Bool) (need some better name) which returns Nothing on 404, but that might be an overkill.

@chrisdone
Copy link
Member

It could return a Status?

@chrisdone
Copy link
Member

Although catching the exception and throwing a build-plan-specific exception is fine.

@zudov
Copy link
Contributor Author

zudov commented Jun 27, 2015

@chrisdone Hmm. Having something like:

-- | Same as 'download' but catching StatusCodeException and returning 'Status'
downloadWithStatus :: _ -> _ -> _ (Either Status Bool)

might be useful not only for this case.

zudov added a commit to zudov/stack that referenced this issue Jun 27, 2015
The old behaviour is described in commercialhaskell#434

The new behavior looks as follows:

    Downloading lts-42.0 build plan ...SnapshotNotFound "lts-42.0"
    Non existing resolver: "lts-42.0".
    For a complete list of available snapshots see https://www.stackage.org/snapshots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants