Brands an error with the status it should be answered with.
The error is branded in place and returned, so identity is preserved and a
throw withHttpStatusHint(new Xyz(…), hint) reads as one statement. The
property is symbol-keyed and non-enumerable, so it is invisible to
Object.keys, JSON.stringify and spread, and the error behaves exactly as
it did — instanceof, name, message and cause are all untouched.
Brands an error with the status it should be answered with.
The error is branded in place and returned, so identity is preserved and a
throw withHttpStatusHint(new Xyz(…), hint)reads as one statement. The property is symbol-keyed and non-enumerable, so it is invisible toObject.keys,JSON.stringifyand spread, and the error behaves exactly as it did —instanceof,name,messageandcauseare all untouched.