Chapter 6.1 - Detecting a Dropped Connection
Errors related to offline tax calculation can be complex when the connection has dropped. Errors are generated from different locations:
- Communications REST v2
- The operating system
- Your software development suite
A dropped connection produces a different kind of error - for example, AspNetCore produces a
WinHttpException when a connection is dropped using HttpClient. Your task is to identify how the operating system or programming language exposes a connection error. Once you have identified this error, your code must trap the exception, ensure that you can respond correctly, and prevent the exception from being exposed to the end user or calling system.
Set an appropriate timeout value for your needs within your application. We cannot tell you exactly what timeout value is best for you; but in our experience, interactive web applications tend to have a shorter timeout and desktop accounting programs tend to have a longer timeout.
Now that you’ve prepared for a timeout in your application, the next step is to decide whether to retry your transaction or fall back to a cached tax data.