# Ability to add custom error messages for Object.freeze() & Object.seal() TypeErrors

**URL:** <https://es.discourse.group/t/ability-to-add-custom-error-messages-for-object-freeze-object-seal-typeerrors/440>\
**Category:** 💡 Ideas\
**Created:** [August 22, 2020, 8:41pm UTC](https://es.discourse.group/t/ability-to-add-custom-error-messages-for-object-freeze-object-seal-typeerrors/440 "2020-08-22T20:41:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brantphoto](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/brantphoto/32/411_2.png) [@brantphoto](https://es.discourse.group/u/brantphoto)\
**Post date:** [August 22, 2020, 8:41pm UTC](https://es.discourse.group/t/ability-to-add-custom-error-messages-for-object-freeze-object-seal-typeerrors/440/1 "2020-08-22T20:41:50Z")

</div>

Had a thought while reviewing Object.freeze() and Object.seal() documentation. I kind of wish those methods took a second argument, maybe a string error message or something like that, to help provide more context to whoever tries to mutate or reconfigure said object and receives the error.

It's great to know that something is frozen but also seems like an opportunity for a library author to point a developer in the right direction if they are trying to change something that they shouldn't, such as 'Utilize this API if you're looking to edit application state'.

Not sure. First post on this forum. Wonder what others think.

Cheers,  
Brant

---

<div class="post-metadata">

**Author:** ![ljharb](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/ljharb/32/8_2.png) [@ljharb](https://es.discourse.group/u/ljharb)\
**Post date:** [August 23, 2020, 9:07pm UTC](https://es.discourse.group/t/ability-to-add-custom-error-messages-for-object-freeze-object-seal-typeerrors/440/2 "2020-08-23T21:07:42Z")

</div>

It seems like you could achieve this with a Proxy already; it'd probably be worth doing that and seeing if the approach gains traction in the community.
