withHttpStatusHint<T extends Error>(error: T,hint: HttpStatusHint): T
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.
error: T
The error to brand
hint: HttpStatusHint
How it should be answered
The same error reference, branded