Fixing Exceptions and Exception-Handling

This commit is contained in:
Denis Knauf 2020-12-28 00:29:54 +01:00
parent ad6f53bab3
commit cae3692008
3 changed files with 4 additions and 4 deletions

View file

@ -120,7 +120,7 @@ class DenCli::Interactive
return nil if line.nil?
begin
cur.call *line
rescue ::UsageError
rescue ::DenCli::UsageError
STDERR.puts "! #$!"
end
true

View file

@ -22,7 +22,7 @@ class DenCli::Sub
elsif @aliases.has_key? n
@aliases[n].help *a
else
raise UnknownCommand, "unknown command: #{_full_cmd( [n])[1..-1].join ' '}, available for #{full_cmd[1..-1].join' '}: #{@subs.keys.join ' '}"
raise DenCli::UnknownCommand, "unknown command: #{_full_cmd( [n])[1..-1].join ' '}, available for #{full_cmd[1..-1].join' '}: #{@subs.keys.join ' '}"
end
end
@ -31,7 +31,7 @@ class DenCli::Sub
if @aliases.has_key? n
@aliases[n].call *a
else
raise UnknownCommand, "unknown command: #{_full_cmd( [n])[1..-1].join ' '}, available for #{full_cmd[1..-1].join' '}: #{@subs.keys.join ' '}"
raise DenCli::UnknownCommand, "unknown command: #{_full_cmd( [n])[1..-1].join ' '}, available for #{full_cmd[1..-1].join' '}: #{@subs.keys.join ' '}"
end
end

View file

@ -1,3 +1,3 @@
class DenCli
VERSION = '0.2.0'
VERSION = '0.2.1'
end