To resolve this you need to catch connection error. When the connection fails for webapp, it happens on web server, not within application. You can find out the web server log by below steps:
Open the web application --> Go to Application Service logs --> Go to Web server logging (there are multiple switches there) You can also see the errors live going to "Log stream" pane.
To ensure that you will get web server log, you have to enable it.

Reference:
https://docs.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs