Skip to content

Expose default transient SQL error codes for extensibility #2342

@ankrause

Description

@ankrause

Is your feature request related to a problem? Please describe.

Currently, the default set of transient error codes is private. This seems to make it difficult to extend error codes without copy/pasting the base set from this repository.

I understand that this field is likely private because it is a modifiable hashset: s_defaultTransientErrors. It would be strange for the consuming code to add values directly to the set which is then used everywhere by default - perhaps unknowingly.

Specifying SqlRetryLogicOption.TransientErrors currently is a total override rather than an add. So, it isn't possible to just add 1 or 2 error codes to the generally accepted pre-defined list.

Describe the solution you'd like

I would like to be able to get a copy of the set and add to it when building a new SqlRetryLogicOption. It doesn't really matter to the consumer how it is exposed as long as the values can be used.

  • Expose property as readonly/immutable type from which a copy can be made.
  • Property/method/etc. that returns a copy of the set.
  • Any other functionally equivalent option.

Describe alternatives you've considered

The only thing I've seen documented so far is a total override (as mentioned above) wherein the consumer just specifies their own codes. Alternatively, the consumer has to copy/paste the core set of transient errors into their own code and then add to it inline. This also means the consumer doesn't get any automatic upgrades if Azure/SqlClient define new transient codes (or re-defines old ones as transient).

Metadata

Metadata

Labels

No labels
No labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions