lib/shhh/application.rb in shhh-1.6.2 vs lib/shhh/application.rb in shhh-1.6.3

- old
+ new

@@ -27,22 +27,24 @@ elsif opts[:decrypt] :decr end end - def execute + def execute! if args.do_options_require_key? || args.do_options_specify_key? self.key = Shhh::App::PrivateKey::Handler.new(opts, input_handler).key raise Shhh::Errors::NoPrivateKeyFound.new('Private key is required') unless self.key end unless command raise Shhh::Errors::InsufficientOptionsError.new( 'Can not determine what to do from the options ' + opts_hash.keys.reject { |k| !opts[k] }.to_s) end - self.result = command.execute - return result + end + + def execute + execute! rescue ::OpenSSL::Cipher::CipherError => e error type: 'Cipher Error', details: e.message, reason: 'Perhaps either the secret is invalid, or encrypted data is corrupt.',