diff --git a/lib/console1984/command_executor.rb b/lib/console1984/command_executor.rb index a621e7d..ef5d765 100644 --- a/lib/console1984/command_executor.rb +++ b/lib/console1984/command_executor.rb @@ -101,12 +101,16 @@ def run_command(run_by_user, &block) end def encrypting_error(error) - def error.inspect - Console1984.command_executor.execute_in_protected_mode { super } + if error.respond_to?(:inspect) + def error.inspect + Console1984.command_executor.execute_in_protected_mode { method(:inspect).super_method.call } + end end - def error.to_s - Console1984.command_executor.execute_in_protected_mode { super } + if error.respond_to?(:to_s) + def error.to_s + Console1984.command_executor.execute_in_protected_mode { method(:to_s).super_method.call } + end end error