Skip to content

Commit 6fe2328

Browse files
authored
Accept 2xx (including 201 Created) from Registry API on publish (#1417)
1 parent e508f4f commit 6fe2328

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
Bugfixes:
11+
* 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`
1112
* 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
1213
* Retry transient network failures (connection errors and 5xx responses) when fetching package tarballs and calling the registry API, instead of failing immediately
1314

‎src/Spago/Registry.purs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ callRegistry url outputCodec maybeInput = handleError do
448448
case response of
449449
Nothing -> pure $ Left $ "Could not reach the registry at " <> url
450450
Just (Left err) -> pure $ Left $ "Error while calling the registry:\n " <> Exception.message err
451-
Just (Right { status, text }) | status /= 200 -> do
451+
Just (Right { status, text }) | status < 200 || status >= 300 -> do
452452
bodyText <- liftAff text
453453
pure $ Left $ "Registry did not like this and answered with status " <> show status <> ", got answer:\n " <> bodyText
454454
Just (Right { json }) -> do

0 commit comments

Comments
 (0)