Exemplo n.º 1
0
 public override void ReportError(
     string groupIdentifier,
     string condition,
     YandexAppMetricaErrorDetails errorDetails)
 {
     ymm_reportErrorWithIdentifierAndMessage(groupIdentifier, condition,
                                             JsonStringFromDictionary(errorDetails.ToHashtable()));
 }
Exemplo n.º 2
0
 public override void ReportError(
     string groupIdentifier,
     string condition,
     YandexAppMetricaErrorDetails errorDetails)
 {
     CallYandexMetricaPlugins("reportError", new[] { "String", "String", "PluginErrorDetails" },
                              groupIdentifier, condition, errorDetails.ToAndroidPluginErrorDetails());
 }
Exemplo 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);
    }
Exemplo 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);
        }
    }
Exemplo 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);
        }
    }
Exemplo 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()));
        }
    }
Exemplo 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());
        }
    }
Exemplo 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);
        }
    }
Exemplo 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());
        }
    }
Exemplo 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
     );
Exemplo n.º 12
0
 public override void ReportUnhandledException(YandexAppMetricaErrorDetails errorDetails)
 {
 }
Exemplo n.º 13
0
 public override void ReportError(YandexAppMetricaErrorDetails errorDetails, string condition)
 {
 }
Exemplo n.º 14
0
 public override void ReportError(YandexAppMetricaErrorDetails errorDetails, string condition)
 {
     ymm_reportErrorWithMessage(JsonStringFromDictionary(errorDetails.ToHashtable()), condition);
 }
Exemplo n.º 15
0
 public override void ReportUnhandledException(YandexAppMetricaErrorDetails errorDetails)
 {
     CallYandexMetricaPlugins("reportUnhandledException", new[] { "PluginErrorDetails" },
                              errorDetails.ToAndroidPluginErrorDetails());
 }
Exemplo 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);
Exemplo n.º 19
0
 public override void ReportError(YandexAppMetricaErrorDetails errorDetails, string condition)
 {
     CallYandexMetricaPlugins("reportError", new[] { "PluginErrorDetails", "String" },
                              errorDetails.ToAndroidPluginErrorDetails(), condition);
 }