Skip to content

Commit

Permalink
Merge pull request #108 from lencioni/error-message
Browse files Browse the repository at this point in the history
Raise ArgumentError if required options are falsey
  • Loading branch information
qoobaa committed Aug 6, 2015
2 parents 073a551 + b55b6e3 commit 90956f2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/s3/service.rb
Expand Up @@ -25,6 +25,12 @@ def ==(other)
# * <tt>:timeout</tt> - Timeout to use by the Net::HTTP object
# (60 by default)
def initialize(options)
# The keys for these required options might exist in the options hash, but
# they might be set to something like `nil`. If this is the case, we want
# to fail early.
raise ArgumentError, "Missing :access_key_id." if !options[:access_key_id]
raise ArgumentError, "Missing :secret_access_key." if !options[:secret_access_key]

@access_key_id = options.fetch(:access_key_id)
@secret_access_key = options.fetch(:secret_access_key)
@use_ssl = options.fetch(:use_ssl, false)
Expand Down

0 comments on commit 90956f2

Please sign in to comment.