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

Add category to deprecation warnings #528

Merged
merged 1 commit into from Apr 27, 2023

Conversation

wata727
Copy link
Contributor

@wata727 wata727 commented Apr 26, 2023

See #523
See https://ruby-doc.org/3.2.2/Warning.html
See https://bugs.ruby-lang.org/issues/17000

The deprecation warning about PG::Coder.new(hash) introduced in v1.5.0 is so frequently reported that it would be more useful if a user had better control over the warning.

This PR sets the category for deprecation warnings. Setting category: :deprecated will only show warnings to users who either set Warning[:deprecated] = true or set RUBYOPT=-W:deprecated. Warning[:deprecated] = false by default since Ruby 2.7.2, so it suppresses the warning for most users.

@wata727 wata727 changed the title Add category to deprecated warnings Add category to deprecation warnings Apr 26, 2023
@larskanis larskanis merged commit d1f5aaa into ged:master Apr 27, 2023
15 of 16 checks passed
@wata727 wata727 deleted the add_warn_category branch April 27, 2023 08:55
larskanis added a commit to larskanis/ruby-pg that referenced this pull request Apr 27, 2023
Avoid error "uninitialized constant Truffle::WarningOperations" on Truffleruby up to 22.3.1

The error was triggered by adding the :deprecation category in ged#528
larskanis added a commit to larskanis/ruby-pg that referenced this pull request Apr 27, 2023
Avoid error "uninitialized constant Truffle::WarningOperations" on Truffleruby up to 22.3.1

The error was triggered by adding the :deprecation category in ged#528
@larskanis
Copy link
Collaborator

Thanks for the change! Unfortunately it breaks on the current Truffleruby release, but I added #529 to work around it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants