コード例 #1
0
 private void KcvdbClient_SendingError(object sender, SendingErrorEventArgs e)
 {
     try {
         TelemetryClient.TrackException("Sending error catched.", e.Exception, new {
             ErrorMessage = e.Message,
             Reason       = e.Reason,
         });
     }
     catch (Exception ex) {
         if (ex.IsCritical())
         {
             throw;
         }
     }
 }
コード例 #2
0
ファイル: Network.cs プロジェクト: xRoier/DiscordIntegration
 /// <summary>
 /// Called after the network thrown an exception while sending data.
 /// </summary>
 /// <param name="sender">The sender instance.</param>
 /// <param name="ev">The <see cref="SendingErrorEventArgs"/> instance.</param>
 protected virtual void OnSendingError(object sender, SendingErrorEventArgs ev) => SendingError?.Invoke(sender, ev);
コード例 #3
0
 /// <inheritdoc cref="API.Network.OnSendingError(object, SendingErrorEventArgs)"/>
 public void OnSendingError(object _, SendingErrorEventArgs ev)
 {
     Log.Error($"[NET] {string.Format(Language.SendingDataError, Instance.Config.IsDebugEnabled ? ev.Exception.ToString() : ev.Exception.Message)}");
 }
コード例 #4
0
ファイル: KCVDBApiItem.cs プロジェクト: CoRelaxuma/HoppoAlpha
        public static IEnumerable<KCVDBApiItem> CreateInstance(SendingErrorEventArgs sendingErrorArgs)
        {
            if (sendingErrorArgs.ApiData == null || sendingErrorArgs.TrackngIds == null) yield break;

            foreach (var i in Enumerable.Range(0, Math.Min(sendingErrorArgs.ApiData.Length, sendingErrorArgs.TrackngIds.Length)))
            {
                var item = new KCVDBApiItem();

                if (sendingErrorArgs.ApiData[i] != null)
                {
                    item.Date = DateConverter(sendingErrorArgs.ApiData[i].HttpDateHeaderValue);
                    item.Url = sendingErrorArgs.ApiData[i].RequestUri;
                    item.HttpStatusCode = sendingErrorArgs.ApiData[i].StatusCode;
                }
                item.SendStatus = KCVDBSendStatus.SendingError;
                item.TrackingId = sendingErrorArgs.TrackngIds[i];
                item.ErrorMessage = sendingErrorArgs.Message;

                yield return item;
            }
        }