/// <summary> /// Initializes a new instance of the <see cref="SystemError"/> class. /// </summary> /// <param name="applicationId">The application id.</param> /// <param name="ex">The ex.</param> /// <param name="system">The system.</param> /// <param name="version">The version.</param> public SystemError(Guid applicationId, ExceptionDescriptive ex, AnalyticsSystem system, Guid sessionId, String version) { this.ApplicationId = applicationId; this.Version = version; this.DeviceType = system.DeviceType; this.ExceptionMessage = ex.Message; this.ExceptionData = ex.Data; this.ExceptionSource = ex.Source; this.ExceptionStackTrace = ex.StackTrace; this.DateCreated = DateTime.Now; this.SessionId = sessionId; }
/// <summary> /// Initializes a new instance of the <see cref="ErrorItem"/> class. /// </summary> /// <param name="applicationId">The application id.</param> /// <param name="screenName">Name of the screen.</param> /// <param name="data">The data.</param> /// <param name="deviceGeneralInformation">The device general information.</param> /// <param name="eventName">Name of the event.</param> /// <param name="ex">The ex.</param> /// <param name="sessionId">The session id.</param> /// <param name="version">The version.</param> public ErrorItem(Guid applicationId, String screenName, String data, DeviceGeneralInformation deviceGeneralInformation, String eventName, ExceptionDescriptive ex, Guid sessionId, String version) { this.ApplicationId = applicationId; this.Version = version; this.ScreenName = screenName; this.Data = data; this.AvailableFlashDriveSize = deviceGeneralInformation.AvailableFlashDriveSize; this.AvailableMemorySize = deviceGeneralInformation.AvailableMemorySize; this.Battery = deviceGeneralInformation.Battery; this.NetworkCoverage = deviceGeneralInformation.NetworkCoverage; this.EventName = eventName; this.DateCreated = DateTime.Now; this.SessionId = sessionId; }
/// <summary> /// Logs the system error. /// </summary> /// <param name="exceptionDatabaseLayer">The exception database layer.</param> private void logSystemError(ExceptionDescriptive exceptionDescriptive) { try { if (this.databaseExists) { #if DEBUG System.Diagnostics.Debug.WriteLine("logSystemError"); System.Diagnostics.Debug.WriteLine(exceptionDescriptive.Message); System.Diagnostics.Debug.WriteLine(exceptionDescriptive.Source); System.Diagnostics.Debug.WriteLine(exceptionDescriptive.StackTrace); #endif this.iStorageDal.Save(new SystemError(this.applicationId, exceptionDescriptive, new AnalyticsSystem(this.iDeviceInformation.GetDeviceType(), this.iDeviceInformation.GetPluginVersion()), this.sessionId, this.applicationVersion)); this.setItemsWaitingToBeUploaded(); } } catch (ExceptionDatabaseLayer exceptionDatabaseLayer) { #if DEBUG System.Diagnostics.Debug.WriteLine(exceptionDatabaseLayer.Message); System.Diagnostics.Debug.WriteLine(exceptionDatabaseLayer.Source); System.Diagnostics.Debug.WriteLine(exceptionDatabaseLayer.StackTrace); #endif } }
/// <summary> /// Logs the error. /// </summary> /// <param name="screenName">Name of the screen.</param> /// <param name="eventName">Name of the event.</param> /// <param name="data">The data.</param> /// <param name="ex">The ex.</param> public void LogError(string screenName, string eventName, string data, ExceptionDescriptive ex) { if (this.started && this.databaseExists) { try { ErrorItem errorItem = new ErrorItem(this.applicationId, screenName, data, this.iDeviceDynamicInformation.GetDeviceGeneralInformation(), eventName, ex, this.sessionId, this.applicationVersion); this.iStorageDal.Save(errorItem); this.setItemsWaitingToBeUploaded(); if (this.uploadType == UploadType.WhileUsingAsync) { this.uploadIntelligent(); } } catch (ExceptionDatabaseLayer exceptionDatabaseLayer) { this.logSystemError(exceptionDatabaseLayer); } } }