public void EndAction(MatsAction action, AuthenticationResult authenticationResult)
        {
            // todo(mats): map contents of authentication result to appropriate telemetry values.
            AuthOutcome outcome          = AuthOutcome.Succeeded;
            ErrorSource errorSource      = ErrorSource.Service;
            string      error            = string.Empty;
            string      errorDescription = string.Empty;

            EndAction(action, outcome, errorSource, error, errorDescription);
        }
        public void EndAction(MatsAction action, Exception ex)
        {
            AuthOutcome outcome          = AuthOutcome.Failed;
            ErrorSource errorSource      = ErrorSource.AuthSdk;
            string      error            = ex.GetType().Name;
            string      errorDescription = ex.Message;

            switch (ex)
            {
            case MsalUiRequiredException uiEx:
                errorSource = ErrorSource.Service;
                error       = uiEx.ErrorCode;
                break;

            case MsalServiceException svcEx:
                errorSource = ErrorSource.Service;
                error       = svcEx.ErrorCode;
                break;

            case MsalClientException cliEx:
                errorSource = ErrorSource.Client;
                error       = cliEx.ErrorCode;
                break;

            case MsalException msalEx:
                errorSource = ErrorSource.AuthSdk;
                error       = msalEx.ErrorCode;
                break;

            default:
                errorSource = ErrorSource.AuthSdk;
                break;
            }

            EndAction(action, outcome, errorSource, error, errorDescription);
        }
 public ActionArtifacts(MatsAction action, ActionPropertyBag propertyBag)
 {
     Action      = action;
     PropertyBag = propertyBag;
 }
 public void EndAction(MatsAction action, AuthOutcome outcome, ErrorSource errorSource, string error, string errorDescription)
 {
     TelemetryManager.Flush(action.TelemetryCorrelationId);
     _actionStore.EndMsalAction(action, outcome, errorSource, error, errorDescription);
     _uploader.Upload(GetEventsForUpload());
 }