Feature #8649

Make ENV.fetch KeyError give key name in error message.

Added by Matthew Boedicker 9 months ago. Updated 9 months ago.

[ruby-core:56062]
Status:Closed
Priority:Normal
Assignee:-
Category:-
Target version:-

Description

The KeyError raised by ENV.fetch('test') when the 'test' key does not exist does not give the name of the key in the error message.

This patch makes it give a better error message and behave like Hash.fetch.

env_fetch_keyerror.patch Magnifier (1.39 KB) Matthew Boedicker, 07/17/2013 02:10 PM

Associated revisions

Revision 42025
Added by Nobuyoshi Nakada 9 months ago

hash.c: key name in error message

  • hash.c (env_fetch): Add key name to message on ENV.fetch KeyError, as well as Hash#fetch. [Feature #8649]

History

#1 Updated by Nobuyoshi Nakada 9 months ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r42025.
Matthew, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


hash.c: key name in error message

  • hash.c (env_fetch): Add key name to message on ENV.fetch KeyError, as well as Hash#fetch. [Feature #8649]

Also available in: Atom PDF