added error handling code for service-not-available scenario