diff --git a/CHANGELOG.md b/CHANGELOG.md index 67a30651d..7d40276a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] Bugfixes: +* Accept any 2xx status code (not just `200`) as success when calling the Registry API, so that publishing no longer fails when the registry responds with `201 Created` * Fix flaky `SQLITE_IOERR_TRUNCATE` on Windows when multiple spago processes connect concurrently to the cache DB, by skipping `PRAGMA journal_mode = WAL` when it's already enabled (WAL mode is persistent in the DB file header) and tolerating the race on the initial set * Retry transient network failures (connection errors and 5xx responses) when fetching package tarballs and calling the registry API, instead of failing immediately diff --git a/src/Spago/Registry.purs b/src/Spago/Registry.purs index 3f85f4bb0..e4875ea48 100644 --- a/src/Spago/Registry.purs +++ b/src/Spago/Registry.purs @@ -448,7 +448,7 @@ callRegistry url outputCodec maybeInput = handleError do case response of Nothing -> pure $ Left $ "Could not reach the registry at " <> url Just (Left err) -> pure $ Left $ "Error while calling the registry:\n " <> Exception.message err - Just (Right { status, text }) | status /= 200 -> do + Just (Right { status, text }) | status < 200 || status >= 300 -> do bodyText <- liftAff text pure $ Left $ "Registry did not like this and answered with status " <> show status <> ", got answer:\n " <> bodyText Just (Right { json }) -> do