Fixed file download cancellation handling - changed the code to not call abortController.abort() in progress callback function. Progress callback function is called on data stream event in clients, which results in an unhandled error, since the error is thrown not in the scope of iModelsClient.changesets.downloadList or iModelsClient.changesets.downloadSingle, but in the global context.
Same unhandled exception can be reproduced if we just throw a random error (throw new Error("foo")) in progress callback instead of calling abortController.abort(), so it is not specific to this particular abort controller. However, the behavior of abort controller makes it more difficult to debug the situation, since abortController.abort() does not just throw an error internally, but it emits an abort event, which is listened to by Azure SDK, and the listener function calls stream.destroy(errorToThrow).
The question remains why this worked previously. With this PR https://github.com/iTwin/imodels-clients/pull/272 we can see in pnpm-lock.yaml that Azure SDK internals were updated, so it is likely that they changed something on their end how abort signals are processed.
In this PR:
Fixed file download cancellation handling - changed the code to not call
abortController.abort()
in progress callback function. Progress callback function is called ondata
stream event in clients, which results in an unhandled error, since the error is thrown not in the scope ofiModelsClient.changesets.downloadList
oriModelsClient.changesets.downloadSingle
, but in the global context.Same unhandled exception can be reproduced if we just throw a random error (
throw new Error("foo")
) in progress callback instead of callingabortController.abort()
, so it is not specific to this particular abort controller. However, the behavior of abort controller makes it more difficult to debug the situation, sinceabortController.abort()
does not just throw an error internally, but it emits anabort
event, which is listened to by Azure SDK, and the listener function callsstream.destroy(errorToThrow)
.The question remains why this worked previously. With this PR https://github.com/iTwin/imodels-clients/pull/272 we can see in
pnpm-lock.yaml
that Azure SDK internals were updated, so it is likely that they changed something on their end howabort
signals are processed.Enabled tests which were disabled with this PR https://github.com/iTwin/imodels-clients/pull/272