Catch errors in device threads