Issue #14278 has been updated by KINGSABRI (KING SABRI).


thanks @shevegen for your reply. 
and yeah I believe we completely agree on everything here. The error should be more description at the same time not losing the known error class in our case (TypeError). the backtrace or the message that the one should be enhanced and be more specific. 

Appreciate your fruitful discussion 

----------------------------------------
Bug #14278: Ambiguous Exception for OpenSSL::HMAC.digest
https://bugs.ruby-lang.org/issues/14278#change-69224

* Author: KINGSABRI (KING SABRI)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux-gnu]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
The `OpenSSL::HMAC.digest` shows unclear and ambiguous exception when key is nil.


~~~ ruby
require 'openssl'

key = nil
OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), key, 'RubyRuby')
TypeError: no implicit conversion of nil into String
`digest'
~~~

**Expected Behavior**
So clear and understandable issue, such: 

~~~ text
key argument cannot be nil for OpenSSL::HMAC.digest
~~~








-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>