Make the HandlerBuilder class extend the CallableObject class.
This will make it easier to use.
e.g.
const handler = new HandlerBuilder()
.on(ValueError, () => { ... })
.on(SyntaxError, () => { ... })
.default(() => { ... });
// example 1
try { ... }
catch (error)
{
handler(error);
}
// example 2
new Promise([...])
.catch(handler);