Skip to content

Commit

Permalink
fix(client): do not raise error again (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
cassidycodes authored Oct 4, 2024
1 parent 95ef686 commit e0c8a0d
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
graphql-hive (0.4.1)
graphql-hive (0.4.2)
graphql (>= 2.3, < 3)

GEM
Expand Down
2 changes: 1 addition & 1 deletion k6/graphql-api/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ../..
specs:
graphql-hive (0.4.1)
graphql-hive (0.4.2)
graphql (>= 2.3, < 3)

GEM
Expand Down
1 change: 0 additions & 1 deletion lib/graphql-hive/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def send(path, body, _log_type)
@options[:logger].debug(response.body.inspect)
rescue StandardError => e
@options[:logger].fatal("Failed to send data: #{e}")
raise e
end

def setup_http(uri)
Expand Down
3 changes: 0 additions & 3 deletions lib/graphql-hive/usage_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ def start_thread
rescue StandardError => e
# ensure configured logger receives exception as well in setups where STDERR might not be
# monitored.
@options[:logger].error('GraphQL Hive usage collection thread terminating')
@options[:logger].error(e)

raise e
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/graphql-hive/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Graphql
module Hive
VERSION = '0.4.1'
VERSION = '0.4.2'
end
end
4 changes: 2 additions & 2 deletions spec/graphql/graphql-hive/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@
client.send('/usage', body, :usage)
end

it 'logs a fatal error and raises an exception when an exception is raised' do
it 'logs a fatal error when an exception is raised' do
allow(http).to receive(:request).and_raise(StandardError.new('Network error'))
expect(options[:logger]).to receive(:fatal).with('Failed to send data: Network error')
expect { client.send('/usage', body, :usage) }.to raise_error(StandardError, 'Network error')
expect { client.send('/usage', body, :usage) }.not_to raise_error(StandardError, 'Network error')
end
end
end

0 comments on commit e0c8a0d

Please sign in to comment.