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

Clarify error message when asset not in the asset pipeline. #421

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/sprockets/rails/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,17 @@ def compute_asset_path(path, options = {})
File.join(assets_prefix || "/", legacy_debug_path(asset_path, debug))
else
message = "The asset #{ path.inspect } is not present in the asset pipeline."
raise AssetNotFound, message unless unknown_asset_fallback

unless unknown_asset_fallback
message << "\nThe following asset resolver strategies were used: "
message << (asset_resolver_strategies.join(', ').presence ||
'none (refer to: `config.assets.resolve_with` on https://github.com/rails/sprockets-rails)')

raise AssetNotFound, message
end

if respond_to?(:public_compute_asset_path)
message << "Falling back to an asset that may be in the public folder.\n"
message << "\nFalling back to an asset that may be in the public folder.\n"
message << "This behavior is deprecated and will be removed.\n"
message << "To bypass the asset pipeline and preserve this behavior,\n"
message << "use the `skip_pipeline: true` option.\n"
Expand Down