DEV: raise plugin specific errors on failure
Dieser Commit ist enthalten in:
Ursprung
cdb9ec6c3e
Commit
5f24882ef6
2 geänderte Dateien mit 5 neuen und 4 gelöschten Zeilen
|
@ -74,6 +74,7 @@ after_initialize do
|
|||
../lib/custom_wizard/api/endpoint.rb
|
||||
../lib/custom_wizard/api/log_entry.rb
|
||||
../lib/custom_wizard/liquid_extensions/first_non_empty.rb
|
||||
../lib/custom_wizard/exceptions/exceptions.rb
|
||||
../serializers/custom_wizard/api/authorization_serializer.rb
|
||||
../serializers/custom_wizard/api/basic_endpoint_serializer.rb
|
||||
../serializers/custom_wizard/api/endpoint_serializer.rb
|
||||
|
@ -97,7 +98,7 @@ after_initialize do
|
|||
end
|
||||
|
||||
add_to_class(::Sprockets::DirectiveProcessor, :process_require_tree_discourse_directive) do |path = "."|
|
||||
raise ArgumentError, "path cannot be empty" if path == "."
|
||||
raise CustomWizard::SprocketsEmptyPath, "path cannot be empty" if path == "."
|
||||
|
||||
discourse_asset_path = "#{Rails.root}/app/assets/javascripts/"
|
||||
path = File.expand_path(path, discourse_asset_path)
|
||||
|
@ -106,7 +107,7 @@ after_initialize do
|
|||
if stat && stat.directory?
|
||||
require_paths(*@environment.stat_sorted_tree_with_dependencies(path))
|
||||
else
|
||||
raise ArgumentError, "#{path} not found in discourse core"
|
||||
raise CustomWizard::SprocketsFileNotFound, "#{path} not found in discourse core"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -46,10 +46,10 @@ describe "Sprockets: require_tree_discourse directive" do
|
|||
end
|
||||
|
||||
it "throws ArgumentError if path is empty" do
|
||||
expect { @env.find_asset("require_tree_discourse_empty.js") }.to raise_error(ArgumentError).with_message("path cannot be empty")
|
||||
expect { @env.find_asset("require_tree_discourse_empty.js") }.to raise_error(CustomWizard::SprocketsEmptyPath).with_message("path cannot be empty")
|
||||
end
|
||||
|
||||
it "throws ArgumentError if path is non non-existent" do
|
||||
expect { @env.find_asset("require_tree_discourse_non_existant.js") }.to raise_error(ArgumentError)
|
||||
expect { @env.find_asset("require_tree_discourse_non_existant.js") }.to raise_error(CustomWizard::SprocketsFileNotFound)
|
||||
end
|
||||
end
|
||||
|
|
Laden …
In neuem Issue referenzieren