summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsutosh Palai <asupalai@gmail.com>2016-06-07 11:11:32 +0530
committerAsutosh Palai <asupalai@gmail.com>2016-06-07 11:11:32 +0530
commit5a30dc76ba27fa12d6ffd56b18cd8e022e69d07e (patch)
tree4ce9e701049fbc3ee073ceea508f0d474350a587
parenta11695e7c6e1c7bc7359c2c68f5f835a8117b7f3 (diff)
downloadbundler-5a30dc76ba27fa12d6ffd56b18cd8e022e69d07e.tar.gz
Added a few Error classes
-rw-r--r--lib/bundler/plugin.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb
index caf8b5b800..8de8dab06f 100644
--- a/lib/bundler/plugin.rb
+++ b/lib/bundler/plugin.rb
@@ -8,6 +8,9 @@ module Bundler
autoload :Installer, "bundler/plugin/installer"
autoload :SourceList, "bundler/plugin/source_list"
+ MalformattedPlugin = Class.new(PluginError)
+ UndefinedCommandError = Class.new(PluginError)
+
PLUGIN_FILE_NAME = "plugins.rb".freeze
@commands = {}
@@ -78,7 +81,7 @@ module Bundler
# To be called from Cli class to pass the command and argument to
# approriate plugin class
def exec_command(command, args)
- raise "Command #{command} not found" unless command? command
+ raise UndefinedCommandError, "Command #{command} not found" unless command? command
load_plugin index.command_plugin(command) unless @commands.key? command
@@ -95,7 +98,7 @@ module Bundler
# @raise [Error] if plugins.rb file is not found
def validate_plugin!(plugin_path)
plugin_file = plugin_path.join(PLUGIN_FILE_NAME)
- raise "#{PLUGIN_FILE_NAME} was not found in the plugin!" unless plugin_file.file?
+ raise MalformattedPlugin, "#{PLUGIN_FILE_NAME} was not found in the plugin!" unless plugin_file.file?
end
# Runs the plugins.rb file in an isolated namespace, records the plugin