Skip to content

Commit

Permalink
handle ssl error exception when federated call to a collection
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed May 10, 2024
1 parent 0db56d7 commit 6e2cea0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ontologies_api_client/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def uri_from_context(object, media_type)
def entry_point(media_type, params = {})
params = { include: @include_attrs, display_links: false, display_context: false}.merge(params)
federated_get(params) do |url|
uri_from_context(top_level_links(url), media_type)
uri_from_context(top_level_links(url), media_type) rescue nil
end
end

Expand Down
11 changes: 11 additions & 0 deletions test/models/test_federation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,15 @@ def test_federated_analytics
analytics = LinkedData::Client::Analytics.last_month
refute_empty analytics.onts
end


def test_federation_ssl_error
WebMock.enable!
WebMock.stub_request(:get, "#{LinkedData::Client.settings.rest_url.chomp('/')}")
.to_raise(Faraday::SSLError)
ontologies_federate_one = LinkedData::Client::Models::Ontology.all(display_links: false, display_context: false, invalidate_cache: true)

refute_nil ontologies_federate_one.first.errors
WebMock.disable!
end
end

0 comments on commit 6e2cea0

Please sign in to comment.