| 11 | |
| 12 | export default class FixtureError extends Error { |
| 13 | constructor(difference, { cause } = {}) { |
| 14 | super(); |
| 15 | |
| 16 | // Sigh, still have to manually set the name unfortunately... |
| 17 | named(this.constructor.name, this); |
| 18 | |
| 19 | this.difference = difference; |
| 20 | |
| 21 | // Set cause ourselves, since node < 17 has a bug where it won't show it |
| 22 | // otherwise. Technically, we display it ourselves, but best to be defensive |
| 23 | // in case we modify this implementation later. |
| 24 | if (cause) this.cause = cause; |
| 25 | } |
| 26 | |
| 27 | static toMessage() { |
| 28 | return this.constructor.name; |