From 39eadca76b48fc7841da688f6745e40897ec37ff Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Sat, 6 Apr 2019 00:02:11 -0700 Subject: Add FrozenError#receiver Similar to NameError#receiver, this returns the object on which the modification was attempted. This is useful as it can pinpoint exactly what is frozen. In many cases when a FrozenError is raised, you cannot determine from the context which object is frozen that you attempted to modify. Users of the current rb_error_frozen C function will have to switch to using rb_error_frozen_object or the new rb_frozen_error_raise in order to set the receiver of the FrozenError. To allow the receiver to be set from Ruby, support an optional second argument to FrozenError#initialize. Implements [Feature #15751] --- include/ruby/intern.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/ruby/intern.h b/include/ruby/intern.h index bcbf8424e4..01944fb0e8 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -278,6 +278,7 @@ PRINTF_ARGS(NORETURN(void rb_loaderror(const char*, ...)), 1, 2); PRINTF_ARGS(NORETURN(void rb_loaderror_with_path(VALUE path, const char*, ...)), 2, 3); PRINTF_ARGS(NORETURN(void rb_name_error(ID, const char*, ...)), 2, 3); PRINTF_ARGS(NORETURN(void rb_name_error_str(VALUE, const char*, ...)), 2, 3); +PRINTF_ARGS(NORETURN(void rb_frozen_error_raise(VALUE, const char*, ...)), 2, 3); NORETURN(void rb_invalid_str(const char*, const char*)); NORETURN(void rb_error_frozen(const char*)); NORETURN(void rb_error_frozen_object(VALUE)); -- cgit v1.2.3