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

Raise the error that includes an error message #472

Merged
merged 1 commit into from Jun 14, 2021

Conversation

ghiculescu
Copy link
Member

@ghiculescu ghiculescu commented Mar 18, 2021

Because of the change in #414, this line now raises an error with no helpful message on what you should do to fix it:

SessionsControllerTest#test_auth_for_invited_user:
ActionView::Template::Error: owner-banner.png
    /Users/alex/.rvm/gems/ruby-2.7.2/gems/sprockets-rails-3.2.2/lib/sprockets/rails/helper.rb:372:in `raise_unless_precompiled_asset'

Instead, we should raise the new error class added in #414

This would be a breaking change if you had code that looks like this:

    begin
      @view.javascript_include_tag("not_precompiled")
    rescue StandardError => e
      puts "error" if e.class == Sprockets::Rails::Helper::AssetNotPrecompiled
    end

But that's not very good code. A more normal rescue statement still works fine:

    begin
      @view.javascript_include_tag("not_precompiled")
    rescue Sprockets::Rails::Helper::AssetNotPrecompiled => e
      puts "error"
    end

cc @schneems

@rafaelfranca rafaelfranca merged commit 5c0ecb0 into rails:master Jun 14, 2021
@ghiculescu ghiculescu deleted the use-the-good-error branch June 14, 2021 19:09
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