/// <summary> /// Handles a request to store an asset to the remote server. /// </summary> /// <param name="asset">Asset.</param> /// <exception cref="T:Chattel.AssetWriteException">Thrown if there was an error storing the asset.</exception> public void StoreAssetSync(StratusAsset asset) { asset = asset ?? throw new ArgumentNullException(nameof(asset)); if (asset.Id == Guid.Empty) { throw new ArgumentException("Assets must not have a zero ID"); } try { _provider.PutAsset(StratusAsset.ToWHIPAsset(asset)); } catch (AssetServerError e) { LOG.Log(Logging.LogLevel.Error, () => $"[{_serverHandle}] Error sending asset to server.", e); throw new AssetWriteException(asset.Id, e); } catch (AuthException e) { LOG.Log(Logging.LogLevel.Error, () => $"[{_serverHandle}] Authentication error sending asset to server.", e); throw new AssetWriteException(asset.Id, e); } }
public static void TestStratusAsset_ToWHIPAsset_Correct() { Assert.AreEqual(WHIP_ASSET.Serialize().data, StratusAsset.ToWHIPAsset(STRATUS_ASSET).Serialize().data); }