Error Handling - JoueBien/rtp-midi-transport GitHub Wiki
Errors are always returned or provided as a value rather than throwing. This forces you into handling all error paths rather than ignoring errors or missing them. The error type is accessible from the type member.
const error = new Failure({
message: "error message",
type: "send-failure",
});
if (error.type === "send-failure") {
// handle error.
return;
}