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

Report Rails load errors and continue generating #1087

Merged
merged 1 commit into from
Aug 11, 2022

Conversation

KaanOzkan
Copy link
Contributor

@KaanOzkan KaanOzkan commented Jul 29, 2022

Motivation

Resolves #1080

Implementation

Rescue exceptions thrown during eager loading of the rails application

Tests

Added a test

end

eager_load_rails_app if eager_load
rescue LoadError => e
say("Tapioca attempted to load the Rails application after encountering a `config/application.rb` file," \
Copy link
Member

Choose a reason for hiding this comment

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

Would not this only happen when the file isn't found? I think that would be the only cause for a LoadError.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think about catching all kinds of errors and showing them in the output rather than just LoadError?

Copy link
Contributor Author

@KaanOzkan KaanOzkan Aug 9, 2022

Choose a reason for hiding this comment

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

👍 Modified to rescue StandardError as well as LoadError

@KaanOzkan KaanOzkan force-pushed the ko/report-rails-load-error branch 3 times, most recently from 48030f9 to cd3fd05 Compare August 9, 2022 16:04
@KaanOzkan KaanOzkan marked this pull request as ready for review August 9, 2022 16:04
@KaanOzkan KaanOzkan requested a review from a team as a code owner August 9, 2022 16:04
@KaanOzkan KaanOzkan force-pushed the ko/report-rails-load-error branch from cd3fd05 to 6846710 Compare August 10, 2022 15:54
@@ -1758,5 +1758,40 @@ def title=(title); end
end
end
end

describe "cli::dsl::custom application.rb" do
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The application.rb change was leaking to other tests so I moved it to a new top level describe block.

Other solutions could be changing this to use before_each or to write the original application.rb back at the end.

@KaanOzkan KaanOzkan merged commit a210d42 into main Aug 11, 2022
@KaanOzkan KaanOzkan deleted the ko/report-rails-load-error branch August 11, 2022 15:55
@paracycle paracycle added bugfix backported Backported to stable branch labels Aug 22, 2022
paracycle pushed a commit that referenced this pull request Aug 22, 2022
Report Rails load errors and continue generating
paracycle pushed a commit that referenced this pull request Aug 22, 2022
Report Rails load errors and continue generating
@shopify-shipit shopify-shipit bot temporarily deployed to production August 31, 2022 14:40 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to 0-10-stable September 14, 2022 02:35 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported Backported to stable branch bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bin/tapioca dsl undefined method `config' for nil:NilClass (NoMethodError)
4 participants