-
Notifications
You must be signed in to change notification settings - Fork 58
Description
Easypost API requests can lead to (at least) two major error types:
- Network related errors - DNS resolving, connection, transfer, etc. ... this would include the network errors Easypost encounters while calling the carrier APIs.
- Any other error - data validation errors for example
A client encountering a network related error should retry the request but should not retry it for data validation errors. Currently there is no way a client can differentiate between these error types as there is a single Exception class. So given a background process (or daemon) for address validation or label purchasing, that process is required to keep retrying regardless of the error it encounters. The alternative to that is to detect the error type by parsing the exception message, but that would be a very bad practice, nevermind an almost impossible task since we have no way of knowing all the errors that can appear.
I'm sure you can see how this is a waste of resources for all parties involved, and that letting the client know when to retry (and possibly with what delay) is rather essential.