public ResultData Run(StepStartData data) { try { var accessToken = FindAccessToken(Token); GraphServiceClient connection = AuthenticationHelper.GetAuthenticatedClient(accessToken); OneDriveBaseResult res = ExecuteStep(connection, data); if (res.IsSucceed) { var outputData = OutcomeScenarios[RESULT_OUTCOME_INDEX].OutputData; var exitPointName = OutcomeScenarios[RESULT_OUTCOME_INDEX].ExitPointName; if (outputData != null && outputData.Length > 0) { return(new ResultData(exitPointName, new DataPair[] { new DataPair(outputData[0].Name, res.DataObj) })); } else { return(new ResultData(exitPointName)); } } else { return(new ResultData(ERROR_OUTCOME, new DataPair[] { new DataPair(ERROR_OUTCOME_DATA_NAME, res.ErrorInfo) })); } } catch (Exception ex) { OneDriveErrorInfo ErrInfo = new OneDriveErrorInfo() { ErrorMessage = ex.ToString(), HttpErrorCode = null }; return(new ResultData(ERROR_OUTCOME, new DataPair[] { new DataPair(ERROR_OUTCOME_DATA_NAME, ErrInfo) })); } }
public bool FillFromException(Exception exception) { IsSucceed = false; ErrorInfo = new OneDriveErrorInfo(); if (exception is AggregateException) { var ex = (AggregateException)exception; if (ex.InnerExceptions.Count == 1 && ex.InnerException is ServiceException) { exception = ex.InnerException; } } ; if (exception is ServiceException) { var ex = (ServiceException)exception; ErrorInfo.ErrorMessage = (ex.Message ?? ex.ToString()); ErrorInfo.HttpErrorCode = ex.StatusCode; return(true); } return(false); }