Add initial DisconnectHandler error handling to close session on unretryable error #209
+31
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Addresses #188 and #176.
Adds in default disconnect handler behavior to immediately close sessions on 'non-retryable' errors, which for now is just auth errors. This will result in the following output using the quickstart code from the example:
Other errors will continue to retry indefinitely, as they do today.
Details
I see that there was a large refactor pretty recently. Because of this I did not want to completely redo how the errors were done between the
legacyand main package.This PR adds the
NonRetryableinterface in thelegacyinternal package and then tests for that behavior in the syntactic sugar functionRetryable(error)in theerrors.goin the root directory.This way we can add additional
legacyerrors asNonRetryableby adding the appropriate function. When the decision to refactor away thelegacypackage comes hopefully theRetryablefunction can be reused and nothing calling it will have to change.