daml
daml copied to clipboard
Expose retry information in client bindings
Currently users are on their own from a bindings perspective in figuring out if an error is retryable and they have to dig through the docs. It would be nice if we could provide them some functions to test that.
Sketch from @daravep:
val errorHandler = new LedgerApiClientErrorAdvisor()
while(true) {
try {
doSomethingWithoutErrorHandling()
} catch {
case e: StatusRuntimeException if errorHandler.canRetry(e) =>
logger.warn("Will retry", e)
}
}
@moritzkiefer-da As part of https://github.com/digital-asset/daml/issues/14328 we surfaced the idea of having a function that extracts Ledger API-specific information (among which there's whether the error lends itself to a retry) from a StatusRuntimeException
. If I understand this correctly, this ticket is a subset of that, so I would close it as duplicate, unless I'm missing something.
If you include the RetryInfo
in there, then yes that would be redundant. You may want to change the title of the other ticket. It's not really clear what typed exceptions imply without reading through all the comments. I'll leave it to you to close.
Thinking better about it, I think that ticket's ask is slightly different. I'll re-open this and track this ask in particular, for which we already agree it's something we want.