public void Respond(AssetError err) { if (_handler == null) { throw new AssetAlreadySetException($"Cannot call {nameof(Respond)} twice!"); } _errHandler(err); _handler = null; _errHandler = null; }
public void Respond(StratusAsset asset) { asset = asset ?? throw new ArgumentNullException(nameof(asset)); if (asset.Id != AssetId) { throw new AssetIdMismatchException($"Expecting {AssetId}, but got asset with ID {asset.Id}"); } if (_handler == null) { throw new AssetAlreadySetException($"Cannot call {nameof(Respond)} twice!"); } _handler(asset); _handler = null; _errHandler = null; }
public AssetRequest(Guid assetId, AssetRequestHandler handler, AssetErrorHandler errHandler) { AssetId = assetId; _handler = handler ?? throw new ArgumentNullException(nameof(handler)); _errHandler = errHandler ?? throw new ArgumentNullException(nameof(errHandler)); }