Skip to content

Commit

Permalink
Make raise and rb_raise messages consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuay03 committed Oct 24, 2024
1 parent 3532678 commit 6f1d6a6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.4.0-preview2
2 changes: 1 addition & 1 deletion ext/vernier/vernier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,7 @@ collector_start(VALUE self) {
auto *collector = get_collector(self);

if (!collector->start()) {
rb_raise(rb_eRuntimeError, "already running");
rb_raise(rb_eRuntimeError, "collector already running");
}

return Qtrue;
Expand Down
4 changes: 2 additions & 2 deletions lib/vernier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ def self.start_profile(mode: :wall, **collector_options)
@collector.stop
@collector = nil

raise "Profile already started, stopping..."
raise "profile already started, stopping..."
end

@collector = Vernier::Collector.new(mode, collector_options)
@collector.start
end

def self.stop_profile
raise "No profile started" unless @collector
raise "profile not started" unless @collector

result = @collector.stop
@collector = nil
Expand Down
2 changes: 1 addition & 1 deletion lib/vernier/collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def initialize(mode, options = {})
when :rails, :activesupport
@hooks << Vernier::Hooks::ActiveSupport.new(self)
else
warn "Unknown hook: #{hook.inspect}"
warn "unknown hook: #{hook.inspect}"
end
end

Expand Down
4 changes: 2 additions & 2 deletions test/test_time_collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,14 @@ def test_multiple_starts
Vernier.start_profile(interval: SAMPLE_SCALE_INTERVAL)
Vernier.start_profile(interval: SAMPLE_SCALE_INTERVAL)
end
assert_equal "Profile already started, stopping...", error.message
assert_equal "profile already started, stopping...", error.message
end

def test_stop_without_start
error = assert_raises("No trace started") do
Vernier.stop_profile
end
assert_equal "No profile started", error.message
assert_equal "profile not started", error.message
end

def test_includes_options_in_result_meta
Expand Down

0 comments on commit 6f1d6a6

Please sign in to comment.