Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Sentry.init without block argument #1235

Merged
merged 1 commit into from Jan 27, 2021

Conversation

sue445
Copy link
Contributor

@sue445 sue445 commented Jan 25, 2021

Description

When SENTRY_DSN has been passed from environment variable, config.dsn in Sentry.init is needless.

But simply call Sentry.init will result in an error

e.g.

# example.rb
require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"
  gem "sentry-ruby", "4.1.4"
end

require "sentry-ruby"

Sentry.init
$ SENTRY_DSN=xxxxxx ruby example.rb

/Users/sue445/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sentry-ruby-4.1.4/lib/sentry-ruby.rb:67:in `init': no block given (yield) (LocalJumpError)
	from example.rb:10:in `<main>'

The workaround is below, but it's a bit dirty...

Sentry.init do
  # nop
end

# or

Sentry.init {  }

So I made it possible to call Sentry.init without block

@st0012 st0012 added this to In progress in 4.x via automation Jan 27, 2021
@st0012 st0012 added this to the sentry-ruby-4.1.5 milestone Jan 27, 2021
Copy link
Collaborator

@st0012 st0012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the change 👍

4.x automation moved this from In progress to Reviewer approved Jan 27, 2021
@st0012 st0012 merged commit 1f77277 into getsentry:master Jan 27, 2021
4.x automation moved this from Reviewer approved to Done Jan 27, 2021
@sue445 sue445 deleted the sentry_init_without_block_arg branch January 27, 2021 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
4.x
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants