public async Task OnCompletedAsync(UploadCompletedEvent @event,
                                           CancellationToken ct)
        {
            var(asset, _) = await client.ReadObjectResponseCoreAsync <AssetDto>(@event.Response, NullHeaders, default);

            if (asset == null)
            {
                var exception = new SquidexManagementException("Response was null which was not expected.", 0, string.Empty, NullHeaders, null);

                await inner.OnFailedAsync(new AssetUploadExceptionEvent(@event.FileId, exception), ct);

                return;
            }

            await inner.OnCompletedAsync(new AssetUploadCompletedEvent(@event.FileId, asset), ct);
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AssetUploadExceptionEvent"/> class with the thrown exception.
 /// </summary>
 /// <param name="fileId">The file id that can be used to resume an upload.</param>
 /// <param name="exception">The thrown exception.</param>
 public AssetUploadExceptionEvent(string fileId, SquidexManagementException exception)
     : base(fileId)
 {
     Exception = exception;
 }