alexreardon / tiny-invariant

A tiny invariant function

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

idea: extra param for more details

Offirmo opened this issue · comments

In dev mode, just an error can be a bit terse. I then have to find the failing assertion and add a bunch of console.log about the current state.

I could include the data in the error message, but:

  • it's not good for privacy
  • it's not good for matching the error in logs

How about an extended API assert(digits.startsWith(ref_digits), 'xxx() ref_digits must match', () => console.error({digits, ref_digits}))

What do you think?