0

I'm attempting to catch just this exception and no other exceptions. I do not want to have to hard code the exception's message text and was hoping I could accomplish it by having a specific catch to catch a TimeoutException, but didn't know if that was the correct one or not. I do not have a good way of testing this catch before installing, so I wanted to see if the community had any information in regards to the type of exception that is being thrown when this error occurs.

Thanks in advance!

Private Sub RunCalculateProcess(calculateDailyLastRanTS As DateTime)
    Try
        Dim response = New CalculateWorkProxy(ProxyContractOptions.DevLocalIisExpress).Calculate()
    Catch ex As TimeoutException
        Logger.LogError(ex, "Timeout Error", "")
    Catch ex As Exception
        Logger.LogError(ex, "Every other exception", "")
    End Try
End Sub
Sam Williams
  • 162
  • 13
  • Show us your code. So that we can understand your question better. – Selim Yildiz Jan 14 '20 at 15:40
  • @SelimYıldız the code won't help as this is a simple question about exception types, but I've added the code in question. – Sam Williams Jan 14 '20 at 15:43
  • I'd recommend to start with documentation. As a general rule, things that are documented are part of the contract and much less likely to change; the contract may state that one exception will be raised, while the implementation may raise a subtype that is subject to change without notice in the future. In the absence of any documentation, you could debug or peek into the implementation of the routine you call to see what type of exception it raises. – Craig Jan 15 '20 at 14:27

1 Answers1

1

The exception The HTTP request to *.svc has exceeded the allotted timeout..." is considered a TimeoutException in .Net

I was able to catch the exception using my above code and it logged correctly.

Sam Williams
  • 162
  • 13