Issue #15883 has been reported by jeremyevans0 (Jeremy Evans).

----------------------------------------
Feature #15883: Include inspect value of object in FrozenError messages
https://bugs.ruby-lang.org/issues/15883

* Author: jeremyevans0 (Jeremy Evans)
* Status: Open
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
* Target version: 
----------------------------------------
`FrozenError#receiver` was added recently for getting the related object programmatically.  However, there are cases where FrozenError is raised and not handled, and in those cases the resulting error messages lack detail, which makes debugging the error more difficult, especially in cases where the error is not easily reproducible. This includes the inspect value of the frozen object in `FrozenError` messages, which should make debugging simpler.

# Before:

```
class A; end
A.freeze
def A.a; end
# can't modify frozen Class
'a'.freeze << 'b'
# can't modify frozen String
```

# After:

```
class A; end
A.freeze
def A.a; end
# can't modify frozen Class: A
'a'.freeze << 'b'
# can't modify frozen String: "a"
```

Attached is a patch that implements this feature.  If there are no objections, I plan on committing this in about a week.

---Files--------------------------------
frozen-error-message-detail.patch (3.23 KB)


-- 
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>