Skip to content

Commit

Permalink
Do not re-raise if Vernier crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
solnic committed Aug 31, 2024
1 parent c79956a commit 2260888
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions sentry-ruby/lib/sentry/vernier/profiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def set_initial_sample_decision(transaction_sampled)

def start
return unless @sampled
return if !@started
return if @started

::Vernier.start_profile
@started = true
Expand All @@ -72,7 +72,6 @@ def start
log("Not started since running elsewhere")
else
log("Failed to start: #{e.message}")
raise e
end
end

Expand Down
4 changes: 2 additions & 2 deletions sentry-ruby/spec/sentry/vernier/profiler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@
end

context "when Vernier crashes" do
it "logs the error and re-raises" do
it "logs the error and does not raise" do
profiler.set_initial_sample_decision(true)

expect(Vernier).to receive(:start_profile).and_raise("boom")

expect { profiler.start }.to raise_error("boom")
expect { profiler.start }.to_not raise_error("boom")
end

it "doesn't start if Vernier raises that it already started" do
Expand Down

0 comments on commit 2260888

Please sign in to comment.