# Error "detail"

**URL:** <https://es.discourse.group/t/error-detail/1857>\
**Category:** 💡 Ideas\
**Tags:** proposal\
**Created:** [December 5, 2023, 5:57pm UTC](https://es.discourse.group/t/error-detail/1857 "2023-12-05T17:57:46Z")\
**Posts on this page:** 1\
**Showing post:** 38

<div class="post-metadata">

**Author:** ![mmkal](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/mmkal/32/2650_2.png) [@mmkal](https://es.discourse.group/u/mmkal)\
**Post date:** [April 16, 2024, 12:44pm UTC](https://es.discourse.group/t/error-detail/1857/38 "2024-04-16T12:44:01Z")

</div>

Re: my summarized problem statement. I like @dmchurch 's one, but maybe a variant that doesn't reference console.log:

> The `Error` class doesn't have a built-in, standard way to add supplemental information to thrown errors, without subclassing or stuffing stringified data into its message.

Re: consensus/no-take-backsies: I agree, and maybe eventually I could fall in line, but I also suspect that simplicity of implementation, lack of edge cases, and precedent are important if we want to get this approved. Just adding `this.detail = options.detail` to the `Error` constructor is about as simple and non-controversial as it gets. Whereas the interpolation proposal has many tricky things to figure out:

- speccing out what happens to a static property in subclasses
- deciding how to format the detail parameters (in my `{foo: {bar: 1}}` case, will we see `[Object object]`?
- adding _another_ two properties to Error, increasing likely clashes (`rawMessage` and `new`)
- figuring out how to handle messages that just so happen to match the placeholder format (would `new Error('Product must have price > $0', {detail: [123]})` be problematic? Maybe this objection is bogus?)

All of those are solvable, but each could be a sticking point gaining consensus. Then documenting how to use, because of this extra complexity, also becomes harder. (Also, I may have misunderstood, please let me know if I've got the wrong end of the stick with any of the above)

* * *

So, trying to put my committee member hat on, I think I would prefer the original, simpler, idea.

Having said that, I still like what you're proposing more than nothing, so I would lend it my (meaningless) vote if the original idea were rejected outright.

@ljharb since you're a delegate who has engaged with this, any thoughts? Did you find the reasons given why `cause` isn't suitable convincing? Any initial sense of whether `new Error('thing failed', {detail: {code: 123}})` or `Error.new`thing failed with code ${123}`` seems more likely to get through?

---

_[View the full topic](https://es.discourse.group/t/error-detail/1857)._
