I have created a number of Custom Exceptions to trap both validation and basic HTTP exceptions. These all work well, and keeps the code DRY. But, I also have a generic catch-all (wildcard) exception handler, for all other errors. Problem is that all the Custom Exceptions all so trigger the wildcard handler. So, I seem to have to add something like if (error.name !== “GenericValidationException” && error.name !== “NotFoundException” && …) to exclude all the Custom Exceptions from this handler. Is there a cleaner way of doing this?
Any more information on this? It seems counter-intuitive that the wildcard handler has priority over the specialised handler.