In my code, i sometimes use the pattern
class CustomError extends Error {
constructor(someBigObject: any) {
super()
this.object = someBigObject
}
get message(): string {
const value = `Failed ${util.inspect(this.object)}`
this.message = value
return value
}
set message(value: string) {
Object.defineProperty(this, 'message', {value, configurable: true, enumerable: true, writable: true})
}
}
Ideally, this should pass, and only fail if there's a get/access in the set and a set/assignment in the get (or a get/access in the get or a set/assignment in the set, obviously)
In my code, i sometimes use the pattern
Ideally, this should pass, and only fail if there's a get/access in the
setand a set/assignment in theget(or a get/access in thegetor a set/assignment in theset, obviously)