Catching server throwing exception