Skip to content
This repository was archived by the owner on May 10, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/travis/github/services/sync_user/repositories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,15 @@ def slugs
end

def fetch
resources.map { |resource| fetch_resource(resource) }.map(&:to_a).flatten.compact
resources.flat_map { |resource| Array(fetch_resource(resource)) }
end
instrument :fetch, :level => :debug

def fetch_resource(resource)
GH[resource] # TODO should be: ?type=#{self.class.type} but GitHub doesn't work as documented
rescue GH::Error => e
log_exception(e)
nil
end

def with_github(&block)
Expand Down
5 changes: 5 additions & 0 deletions spec/travis/github/services/sync_user/repositories_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@
sync.run
end
end

it 'does not explode on GH errors' do
GH.expects(:[]).with('user/repos').raises(GH::Error.new)
expect { sync.run }.to_not raise_error
end
end

describe Travis::Github::Services::SyncUser::Repositories::Instrument do
Expand Down