wrap caught exceptions