示例#1
0
        public void Respond(AssetError err)
        {
            if (_handler == null)
            {
                throw new AssetAlreadySetException($"Cannot call {nameof(Respond)} twice!");
            }

            _errHandler(err);

            _handler    = null;
            _errHandler = null;
        }
示例#2
0
        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;
        }
示例#3
0
 public AssetRequest(Guid assetId, AssetRequestHandler handler, AssetErrorHandler errHandler)
 {
     AssetId     = assetId;
     _handler    = handler ?? throw new ArgumentNullException(nameof(handler));
     _errHandler = errHandler ?? throw new ArgumentNullException(nameof(errHandler));
 }