Catch exception for disconnect