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
If TZInfo-data is not present in windows, let the user know. #19180
Conversation
begin | ||
TZInfo::DataSource.get | ||
rescue DataSourceNotFound | ||
Logger = ActiveSupport::Logger.new(STDOUT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use the Rails.logger here. Or even throw a warning instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should just raise. We don't want the boot to continue.
If tzinfo-data not found, it aborts with the message "tzinfo-data' is not present. Please add gem 'tzinfo-data' to your Gemfile and run bundle install" |
rescue TZInfo::DataSourceNotFound | ||
abort <<-end_message | ||
|
||
tzinfo-data' is not present. Please add gem 'tzinfo-data' to your Gemfile and run bundle install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the extra '
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo, fixing it.
Thanks.
I also wonder if we can test this somehow.. |
Re-raise the exception with a message.
|
@arthurnn @rafaelfranca I chose to raise an exception instead of aborting directly because it would allow for users to rescue the error if they wanted. Thanks |
@sivsushruth I like raising an error 👍 , I still think we should add a regression tests somewhere to make sure this works, and to make sure nobody removes this code. |
@arthurnn @rafaelfranca I cant seem to figure out how/where to write tests for initializer . Any suggestions? Thanks |
I will merge this for now. We dont have windows only tests as far as I can tell, so it makes kinda harder to test this. |
If TZInfo-data is not present in windows, let the user know.
Fixes #19175.
Rails tries calling TZInfo::DataSource.get. If it gets a DataSourceNotFound error then it prints out