ExceptionQ
ExceptionQ[expr]
ExceptionQ[expr, tag]
ExceptionQ[expr, {tag1, tag2, ...}]tests whether expr is a valid Exception object. A second argument additionally tests whether its type is the specified tag or one of its subtypes.
Examples
exception = Exception["DataConsistencyError", 42];
ExceptionQ[exception]
ExceptionQ[exception, "DataConsistencyError"]For a list of tags, matching any one tag is sufficient.
See the official Wolfram Language reference for subtype matching behavior.