public static void AddErrorEvent(EGAErrorSeverity severity, string message) { string severityString = ErrorSeverityToString(severity); // Validate if (!GAValidator.ValidateErrorEvent(severity, message)) { GAHTTPApi.Instance.SendSdkErrorEvent(EGASdkErrorType.Rejected); return; } // Create empty eventData JSONClass eventData = new JSONClass(); // Append event specifics eventData["category"] = CategoryError; eventData["severity"] = severityString; eventData["message"] = message; // Log GALogger.I("Add ERROR event: {severity:" + severityString + ", message:" + message + "}"); // Send to store AddEventToStore(eventData); }
public static void AddErrorEvent(EGAErrorSeverity severity, string message, IDictionary <string, object> fields) { string severityString = ErrorSeverityToString(severity); // Validate if (!GAValidator.ValidateErrorEvent(severity, message)) { //GAHTTPApi.Instance.SendSdkErrorEvent(EGASdkErrorType.Rejected); return; } // Create empty eventData JSONObject eventData = new JSONObject(); // Append event specifics eventData["category"] = CategoryError; eventData["severity"] = severityString; eventData["message"] = message; // Add custom dimensions AddDimensionsToEvent(eventData); // Add custom fields AddFieldsToEvent(eventData, GAState.ValidateAndCleanCustomFields(fields)); // Log GALogger.I("Add ERROR event: {severity:" + severityString + ", message:" + message + "}"); // Send to store AddEventToStore(eventData); }
public static void AddErrorEvent(GAErrorSeverity severity, string message, IDictionary <string, object> fields) { string fieldsAsString = DictionaryToJsonString(fields); #if UNITY_EDITOR if (GAValidator.ValidateErrorEvent(severity, message)) { addErrorEvent((int)severity, message, fieldsAsString); } #else addErrorEvent((int)severity, message, fieldsAsString); #endif }
public static void AddErrorEvent(EGAErrorSeverity severity, string message, IDictionary <string, object> fields, bool mergeFields, bool skipAddingFields) { if (!GAState.IsEventSubmissionEnabled) { return; } string severityString = ErrorSeverityToString(severity); // Validate if (!GAValidator.ValidateErrorEvent(severity, message)) { //GAHTTPApi.Instance.SendSdkErrorEvent(EGASdkErrorType.Rejected); return; } // Create empty eventData JSONObject eventData = new JSONObject(); // Append event specifics eventData["category"] = CategoryError; eventData["severity"] = severityString; eventData["message"] = message; // Add custom dimensions AddDimensionsToEvent(eventData); if (!skipAddingFields) { IDictionary <string, object> fieldsToUse = new Dictionary <string, object>(fields != null && fields.Count > 0 ? fields : GAState.CurrentGlobalCustomEventFields); if (mergeFields && fields != null && fields.Count > 0) { foreach (KeyValuePair <string, object> pair in GAState.CurrentGlobalCustomEventFields) { if (!fieldsToUse.ContainsKey(pair.Key)) { fieldsToUse.Add(pair.Key, pair.Value); } } } // Add custom fields AddFieldsToEvent(eventData, GAState.ValidateAndCleanCustomFields(fieldsToUse)); } // Log GALogger.I("Add ERROR event: {severity:" + severityString + ", message:" + message + "}"); // Send to store AddEventToStore(eventData); }
public void TestValidateErrorEvent() { // Store result bool isValid; // Valid isValid = GAValidator.ValidateErrorEvent(EGAErrorSeverity.Error, "This is a message"); Assert.True(isValid, "Error event should validate"); isValid = GAValidator.ValidateErrorEvent(EGAErrorSeverity.Error, ""); Assert.True(isValid, "Error event should allow empty message"); isValid = GAValidator.ValidateErrorEvent(EGAErrorSeverity.Error, null); Assert.True(isValid, "Error event should allow nil message"); }