diff --git a/Changelog.md b/Changelog.md index adc40086a..83d223c5f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -12,6 +12,7 @@ * Update the suggested Ruby version to 2.7. If you run into trouble during the update and you followed our installation guides, run `rvm install 2.7`. [#8366](https://github.com/diaspora/diaspora/pull/8366) * Upgrade to bundler 2 [#8366](https://github.com/diaspora/diaspora/pull/8366) * Stop checking `/.well-known/host-meta`, check for `/.well-known/nodeinfo` instead [#8377](https://github.com/diaspora/diaspora/pull/8377) +* Handle NodeInfo timeouts gracefully [#8380](https://github.com/diaspora/diaspora/pull/8380) ## Bug fixes * Fix that no mails were sent after photo export [#8365](https://github.com/diaspora/diaspora/pull/8365) diff --git a/lib/connection_tester.rb b/lib/connection_tester.rb index 810a3f2bd..d66f418f8 100644 --- a/lib/connection_tester.rb +++ b/lib/connection_tester.rb @@ -109,7 +109,7 @@ class ConnectionTester raise NetFailure, e.message rescue Faraday::SSLError => e raise SSLFailure, e.message - rescue ArgumentError, Faraday::ClientError => e + rescue ArgumentError, Faraday::ClientError, Faraday::ServerError => e raise HTTPFailure, "#{e.class}: #{e.message}" rescue StandardError => e unexpected_error(e) diff --git a/spec/lib/connection_tester_spec.rb b/spec/lib/connection_tester_spec.rb index a0dce4d4f..d665dd717 100644 --- a/spec/lib/connection_tester_spec.rb +++ b/spec/lib/connection_tester_spec.rb @@ -94,6 +94,11 @@ describe ConnectionTester do expect { tester.request }.to raise_error(ConnectionTester::HTTPFailure) end + it "receives a 502 bad gateway" do + stub_request(:get, url).to_return(status: 502, body: "Bad Gateway!") + expect { tester.request }.to raise_error(ConnectionTester::HTTPFailure) + end + it "cannot connect" do stub_request(:get, url).to_raise(Faraday::ConnectionFailed.new("Error!")) expect { tester.request }.to raise_error(ConnectionTester::NetFailure)