Reads the status hint an error was branded with.
Accepts unknown rather than Error because the one caller that matters — an error-handling catch — holds unknown, and a thrown non-Error value is legal JavaScript.
unknown
Error
catch
The thrown value to inspect
The hint, or undefined when the value carries none
undefined
try { await repo.findAll(query);} catch (error) { const hint = httpStatusHintOf(error); if (hint !== undefined) { // Answer hint.status with hint.detail rather than a masked 500. }} Copy
try { await repo.findAll(query);} catch (error) { const hint = httpStatusHintOf(error); if (hint !== undefined) { // Answer hint.status with hint.detail rather than a masked 500. }}
0.4.0
Reads the status hint an error was branded with.
Accepts
unknownrather thanErrorbecause the one caller that matters — an error-handlingcatch— holdsunknown, and a thrown non-Errorvalue is legal JavaScript.