Actions
Feature #15883
closedInclude inspect value of object in FrozenError messages
Description
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
Updated by jeremyevans0 (Jeremy Evans) over 5 years ago
- Status changed from Open to Closed
Committed as f1f04caf60e4fc9dc3b12109e0be831f2d692810
Actions
Like0
Like0