From: hanmac@... Date: 2018-01-04T09:53:45+00:00 Subject: [ruby-core:84628] [Ruby trunk Bug#14278] Ambiguous Exception for OpenSSL::HMAC.digest Issue #14278 has been updated by Hanmac (Hans Mackowiak). the Error Message is common for all other stuff, check for example File.read(nil) has same error: ~~~ TypeError: no implicit conversion of nil into String ~~~ implicit conversion means that while an object might has a to_s method like nil, it doesn't has a to_str method (difference between explicit and implicit conversion) the moment when digest does try to convert nil into string, it doesn't know the variable name for this --- similar error: ~~~ 3 * "w" TypeError: String can't be coerced into Integer ~~~ this one means that it failed the coerce between Numeric types ---------------------------------------- Bug #14278: Ambiguous Exception for OpenSSL::HMAC.digest https://bugs.ruby-lang.org/issues/14278#change-69201 * 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: