Exemplo n.º 1
0
        public async Task<IssueResult> RegisterAsync(Exception exception, ExceptionIssueLevel issueLevel = ExceptionIssueLevel.Error, string userHandle = null)
        {
            HandleIssueThreadKey(exception);

            var sessionKey = await _sessionHandler.GetSessionKeyAsync();
            var issueData = PrepareIssueData(sessionKey, exception, issueLevel, userHandle);
            var respnse = await RegisterEx(true, issueData);
            return respnse;
        }
Exemplo n.º 2
0
        private static IssueData PrepareIssueData(Exception exception, ExceptionIssueLevel issueLevel, bool?visibleToUser, string userHandle, string userInput)
        {
            var issueThreadGuid = HandleIssueThreadGuid(exception);
            var data            = exception.Data.Cast <DictionaryEntry>().Where(x => x.Value != null).ToDictionary(item => item.Key.ToString(), item => item.Value.ToString());
            var issueType       = new IssueType(exception, issueLevel.ToIssueLevel());
            var issueData       = new IssueData(Guid.NewGuid(), DateTime.UtcNow, Session.GetSessionData(), visibleToUser, data, issueType, issueThreadGuid, userHandle, userInput);

            return(issueData);
        }
Exemplo n.º 3
0
        public static void BeginRegister(Exception exception, ExceptionIssueLevel issueLevel = ExceptionIssueLevel.Error, bool?visibleToUser = null, string userHandle = null, string userInput = null, Action <RegisterCompleteEventArgs> completeAction = null)
        {
            if (!Configuration.Enabled)
            {
                return;
            }
            Func <IssueData> issueData = () => PrepareIssueData(exception, issueLevel, visibleToUser, userHandle, userInput);

            BeginRegisterEx(issueData, completeAction);
        }
Exemplo n.º 4
0
        public void RegisterStart(Exception exception, ExceptionIssueLevel issueLevel = ExceptionIssueLevel.Error, string userHandle = null)
        {
            HandleIssueThreadKey(exception);

            Task.Run(async () =>
                {
                    var sessionKey = await _sessionHandler.GetSessionKeyAsync();
                    var issueData = PrepareIssueData(sessionKey, exception, issueLevel, userHandle);
                    await RegisterEx(false, issueData);
                });
        }
Exemplo n.º 5
0
        public static IssueResponse Register(Exception exception, ExceptionIssueLevel issueLevel = ExceptionIssueLevel.Error, bool?visibleToUser = null, string userHandle = null, string userInput = null)
        {
            if (!Configuration.Enabled)
            {
                return(null);
            }

            var issueData = PrepareIssueData(exception, issueLevel, visibleToUser, userHandle, userInput);
            var response  = RegisterEx(issueData, null);

            if (!response.Success)
            {
                throw new InvalidOperationException("Unable to register exception. Look at inner exception for details.", response.Exception);
            }

            return(response.IssueResponse);
        }
Exemplo n.º 6
0
        public IssueResult Register(Exception exception, ExceptionIssueLevel issueLevel = ExceptionIssueLevel.Error, string userHandle = null)
        {
            HandleIssueThreadKey(exception);

            try
            {
                var sessionKey = _sessionHandler.GetSessionKeyAsync().Result;
                var issueData = PrepareIssueData(sessionKey, exception, issueLevel, userHandle);
                var response = RegisterEx(true, issueData).Result;
                return response;
            }
            catch (AggregateException exp)
            {
                throw exp.InnerException;
            }
        }
Exemplo n.º 7
0
        private IssueRequest PrepareIssueData(string sessionKey, Exception exception, ExceptionIssueLevel issueLevel, string userHandle)
        {
            var level = issueLevel.ToString();
            var issueType = CreateIssueTypeData(exception);

            var issueData = new IssueRequest
                                {
                                    IssueLevel = level,
                                    UserHandle = userHandle,
                                    ClientTime = DateTime.UtcNow,
                                    IssueKey = Guid.NewGuid(),
                                    IssueThreadKey = HandleIssueThreadKey(exception),
                                    IssueType = issueType,
                                    SessionKey = sessionKey,                                    
                                };

            return issueData;
        }
Exemplo n.º 8
0
 public async static Task <IssueResponse> RegisterAsync(Exception exception, ExceptionIssueLevel issueLevel = ExceptionIssueLevel.Error, bool?visibleToUser = null, string userHandle = null, string userInput = null)
 {
     return(await Task <IssueResponse> .Factory.StartNew(() => Register(exception, issueLevel, visibleToUser, userHandle, userInput)));
 }