Fix exception catching if exception is object