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? return nil if line.nil?
begin begin
cur.call *line cur.call *line
rescue ::UsageError rescue ::DenCli::UsageError
STDERR.puts "! #$!" STDERR.puts "! #$!"
end end
true true

View file

@ -22,7 +22,7 @@ class DenCli::Sub
elsif @aliases.has_key? n elsif @aliases.has_key? n
@aliases[n].help *a @aliases[n].help *a
else 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
end end
@ -31,7 +31,7 @@ class DenCli::Sub
if @aliases.has_key? n if @aliases.has_key? n
@aliases[n].call *a @aliases[n].call *a
else 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
end end

View file

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