From da290c58fe17dbb232b8a1eaff0989cf77e438b4 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 9 Jan 2018 12:45:51 -0700 Subject: [PATCH 1/2] Clarify error message when asset not in the asset pipeline. Ensure people realize when they've configured sprockets to not use any resolvers. --- lib/sprockets/rails/helper.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/sprockets/rails/helper.rb b/lib/sprockets/rails/helper.rb index 01f9f7e9..e44f6672 100644 --- a/lib/sprockets/rails/helper.rb +++ b/lib/sprockets/rails/helper.rb @@ -81,7 +81,14 @@ 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" From beb90f637b097a6336c417b46688fd1ffcfb94ad Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 9 Jan 2018 12:50:59 -0700 Subject: [PATCH 2/2] Fix deprecation concatenation to give some space --- lib/sprockets/rails/helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sprockets/rails/helper.rb b/lib/sprockets/rails/helper.rb index e44f6672..781327f3 100644 --- a/lib/sprockets/rails/helper.rb +++ b/lib/sprockets/rails/helper.rb @@ -91,7 +91,7 @@ def compute_asset_path(path, options = {}) 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"