private void OnOperationError(UIError error)
        {
            onOperationError?.Invoke(this, error);
            FinalizedOperation();

            PackageManagerOperationErrorAnalytics.SendEvent(GetType().Name, error);
        }
        private void OnErrorMessage(string errorMessage, int operationErrorCode = -1, UIError.Attribute attr = UIError.Attribute.None)
        {
            m_State = DownloadState.Error;

            if ((attr & UIError.Attribute.IsWarning) != 0)
            {
                Debug.LogWarning($"{k_ConsoleLogPrefix} {errorMessage}");
            }
            else
            {
                Debug.LogError($"{k_ConsoleLogPrefix} {errorMessage}");
            }

            attr |= UIError.Attribute.IsDetailInConsole;
            if (operationErrorCode == 403)
            {
                m_ErrorMessage = k_ForbiddenErrorMessage;
            }
            else
            {
                attr          |= UIError.Attribute.IsClearable;
                m_ErrorMessage = k_DownloadErrorMessage;
            }

            var error = new UIError(UIErrorCode.AssetStoreOperationError, m_ErrorMessage, attr, operationErrorCode);

            onOperationError?.Invoke(this, error);
            onOperationFinalized?.Invoke(this);

            PackageManagerOperationErrorAnalytics.SendEvent(GetType().Name, error);
        }
Beispiel #3
0
        public static void SendEvent(string operationType, UIError error)
        {
            var servicesContainer    = ServicesContainer.instance;
            var editorAnalyticsProxy = servicesContainer.Resolve <EditorAnalyticsProxy>();

            if (!editorAnalyticsProxy.RegisterEvent(k_EventName))
            {
                return;
            }

            var parameters = new PackageManagerOperationErrorAnalytics
            {
                operation_type = operationType,
                message        = error.message,
                error_type     = error.errorCode.ToString(),
                status_code    = error.operationErrorCode,
                attributes     = error.attribute == UIError.Attribute.None ? new string[0] : error.attribute.ToString().Split(','),
                read_more_url  = error.readMoreURL ?? string.Empty
            };

            editorAnalyticsProxy.SendEventWithLimit(k_EventName, parameters);
        }