Project

General

Profile

Feature #15751

Updated by nobu (Nobuyoshi Nakada) over 5 years ago

Similar to `NameError#receiver`, NameError#receiver, this returns the object on which 
 the modification was attempted.    This is useful as it can pinpoint 
 exactly what is frozen, as in many cases when a `FrozenError` FrozenError is 
 raised, you cannot determine from the context which object is 
 frozen that you expect not to be. 

 I'm not sure that using name_err_receiver as the C function for 
 `FrozenError#receiver` FrozenError#receiver is acceptable, but it doesn't appear to cause 
 problems. 

 Users of the current `rb_error_frozen` rb_error_frozen C function will have to switch 
 to using `rb_error_frozen_object` rb_error_frozen_object or the new `rb_raise_frozen_error` rb_raise_frozen_error 
 in order to set the receiver of the `FrozenError`. FrozenError. 

 Patch to implement this feature is attached.

Back