Refactoring: Added helper function exceptionCauseIsInstanceOf