Esempio n. 1
0
 public override void ReportError(
     string groupIdentifier,
     string condition,
     YandexAppMetricaErrorDetails errorDetails)
 {
     ymm_reportErrorWithIdentifierAndMessage(groupIdentifier, condition,
                                             JsonStringFromDictionary(errorDetails.ToHashtable()));
 }
Esempio n. 2
0
 public override void ReportError(
     string groupIdentifier,
     string condition,
     YandexAppMetricaErrorDetails errorDetails)
 {
     CallYandexMetricaPlugins("reportError", new[] { "String", "String", "PluginErrorDetails" },
                              groupIdentifier, condition, errorDetails.ToAndroidPluginErrorDetails());
 }
Esempio n. 3
0
    internal static AndroidJavaObject ToAndroidPluginErrorDetails(this YandexAppMetricaErrorDetails self)
    {
        if (self == null)
        {
            return(null);
        }

        AndroidJavaObject errorDetails;

        using (AndroidJavaObject builder =
                   new AndroidJavaObject("com.yandex.metrica.plugins.PluginErrorDetails$Builder"))
        {
            builder.Call <AndroidJavaObject>("withPlatform", self.Platform);
            builder.Call <AndroidJavaObject>("withVirtualMachineVersion", self.VirtualMachineVersion);

            if (self.ExceptionClass != null)
            {
                builder.Call <AndroidJavaObject>("withExceptionClass", self.ExceptionClass);
            }

            if (self.Message != null)
            {
                builder.Call <AndroidJavaObject>("withMessage", self.Message);
            }

            if (self.Stacktrace != null)
            {
                AndroidJavaObject androidStacktrace = CreateAndroidList();
                foreach (YandexAppMetricaStackTraceItem stackTraceItem in self.Stacktrace)
                {
                    AndroidJavaObject item = stackTraceItem.ToAndroidStackTraceItem();
                    if (item != null)
                    {
                        androidStacktrace.Call <bool>("add", item);
                    }
                }

                builder.Call <AndroidJavaObject>("withStacktrace", androidStacktrace);
            }

            if (self.PluginEnvironment != null)
            {
                builder.Call <AndroidJavaObject>("withPluginEnvironment", self.PluginEnvironment.ToAndroidMap());
            }

            errorDetails = builder.Call <AndroidJavaObject>("build");
        }

        return(errorDetails);
    }
Esempio n. 4
0
    public override void ReportUnhandledException(Exception exception)
    {
        try
        {
            ReportUnhandledException(YandexAppMetricaErrorDetails.From(exception));
        }
        catch (Exception e)
        {
#if DEBUG
            Debug.Log("[AppMetrica] Failed to parse stacktrace: " + e.Message + "\n" + e.StackTrace);
#endif
            // use old crash format
            ymm_reportError(exception.Message, exception.StackTrace);
        }
    }
Esempio n. 5
0
    public override void ReportErrorFromLogCallback(string condition, string stackTrace)
    {
        try
        {
            ReportUnhandledException(YandexAppMetricaErrorDetails.FromLogCallback(condition, stackTrace));
        }
        catch (Exception e)
        {
#if DEBUG
            Debug.Log("[AppMetrica] Failed to parse stacktrace: " + e.Message + "\n" + e.StackTrace);
#endif
            // use old crash format
            ymm_reportErrorWithIdentifier(condition, condition, stackTrace);
        }
    }
Esempio n. 6
0
    public override void ReportError(string groupIdentifier, string condition, Exception exception)
    {
        try
        {
            ReportError(groupIdentifier, condition,
                        exception == null ? null : YandexAppMetricaErrorDetails.From(exception));
        }
        catch (Exception e)
        {
#if DEBUG
            Debug.Log("[AppMetrica] Failed to parse stacktrace: " + e.Message + "\n" + e.StackTrace);
#endif
            // use old crash format
            ymm_reportErrorWithException(groupIdentifier, condition, JsonStringFromDictionary(exception.ToHashtable()));
        }
    }
Esempio n. 7
0
    public override void ReportUnhandledException(Exception exception)
    {
        try
        {
            ReportUnhandledException(YandexAppMetricaErrorDetails.From(exception));
        }
        catch (Exception e)
        {
#if DEBUG
            Debug.Log("[AppMetrica] Failed to parse stacktrace: " + e.Message + "\n" + e.StackTrace);
#endif
            // use old crash format
            CallAppMetrica("reportUnhandledException", new[] { "Throwable" },
                           exception.ToAndroidThrowable());
        }
    }
Esempio n. 8
0
    public override void ReportErrorFromLogCallback(string condition, string stackTrace)
    {
        try
        {
            ReportUnhandledException(YandexAppMetricaErrorDetails.FromLogCallback(condition, stackTrace));
        }
        catch (Exception e)
        {
#if DEBUG
            Debug.Log("[AppMetrica] Failed to parse stacktrace: " + e.Message + "\n" + e.StackTrace);
#endif
            // use old crash format
            AndroidJavaObject throwableObject = stackTrace == null ? null : ThrowableFromStringStackTrace(stackTrace);
            CallAppMetrica("reportError", new[] { "String", "String", "Throwable" },
                           condition, condition, throwableObject);
        }
    }
Esempio n. 9
0
    public override void ReportError(string groupIdentifier, string condition, Exception exception)
    {
        try
        {
            ReportError(groupIdentifier, condition,
                        exception == null ? null : YandexAppMetricaErrorDetails.From(exception));
        }
        catch (Exception e)
        {
#if DEBUG
            Debug.Log("[AppMetrica] Failed to parse stacktrace: " + e.Message + "\n" + e.StackTrace);
#endif
            // use old crash format
            CallAppMetrica("reportError", new[] { "String", "String", "Throwable" },
                           groupIdentifier, condition, exception.ToAndroidThrowable());
        }
    }
Esempio n. 10
0
    public static Hashtable ToHashtable(this YandexAppMetricaErrorDetails self)
    {
        if (self == null)
        {
            return(null);
        }

        Hashtable data = new Hashtable
        {
            { "Platform", self.Platform }, { "VirtualMachineVersion", self.VirtualMachineVersion }
        };

        if (self.ExceptionClass != null)
        {
            data["ExceptionClass"] = self.ExceptionClass;
        }

        if (self.Message != null)
        {
            data["Message"] = self.Message;
        }

        if (self.Stacktrace != null)
        {
            Hashtable stacktrace = new Hashtable();
            for (int i = 0; i < self.Stacktrace.Count; ++i)
            {
                stacktrace[i.ToString()] = self.Stacktrace[i].ToHashtable();
            }

            data["Stacktrace"] = stacktrace;
        }

        if (self.PluginEnvironment != null)
        {
            data["PluginEnvironment"] = new Hashtable(self.PluginEnvironment);
        }

        return(data);
    }
 public abstract void ReportError(
     string groupIdentifier,
     string condition,
     YandexAppMetricaErrorDetails errorDetails
     );
Esempio n. 12
0
 public override void ReportUnhandledException(YandexAppMetricaErrorDetails errorDetails)
 {
 }
Esempio n. 13
0
 public override void ReportError(YandexAppMetricaErrorDetails errorDetails, string condition)
 {
 }
Esempio n. 14
0
 public override void ReportError(YandexAppMetricaErrorDetails errorDetails, string condition)
 {
     ymm_reportErrorWithMessage(JsonStringFromDictionary(errorDetails.ToHashtable()), condition);
 }
Esempio n. 15
0
 public override void ReportUnhandledException(YandexAppMetricaErrorDetails errorDetails)
 {
     CallYandexMetricaPlugins("reportUnhandledException", new[] { "PluginErrorDetails" },
                              errorDetails.ToAndroidPluginErrorDetails());
 }
Esempio n. 16
0
 public override void ReportUnhandledException(YandexAppMetricaErrorDetails errorDetails)
 {
     ymm_reportUnhandledException(JsonStringFromDictionary(errorDetails.ToHashtable()));
 }
 public abstract void ReportError(YandexAppMetricaErrorDetails errorDetails, string condition);
 public abstract void ReportUnhandledException(YandexAppMetricaErrorDetails errorDetails);
Esempio n. 19
0
 public override void ReportError(YandexAppMetricaErrorDetails errorDetails, string condition)
 {
     CallYandexMetricaPlugins("reportError", new[] { "PluginErrorDetails", "String" },
                              errorDetails.ToAndroidPluginErrorDetails(), condition);
 }