コード例 #1
0
        public void CheckArg(ParserRuleContext context, out ErrorInformation error)
        {
            error = null;
            var identifierContext = ((Arg_declarationContext)context).identifier();

            if (identifierContext != null)
            {
                _identifier = identifierContext.GetText();
                if (_identifier == UppercaseFirst(_identifier))
                {
                    List <ReplaceCodeInfomation> replaceCodes = new List <ReplaceCodeInfomation>()
                    {
                        new ReplaceCodeInfomation()
                        {
                            Start       = identifierContext.Start.StartIndex,
                            Length      = identifierContext.Stop.StopIndex - identifierContext.Start.StartIndex + 1,
                            ReplaceCode = LowercaseFirst(_identifier)
                        }
                    };
                    error = new ErrorInformation
                    {
                        StartIndex   = identifierContext.Start.StartIndex,
                        Length       = identifierContext.Stop.StopIndex - identifierContext.Start.StartIndex + 1,
                        ErrorCode    = "IF0006",
                        DisplayText  = string.Format("Fix name violation: {0}", replaceCodes[0].ReplaceCode),
                        ReplaceCode  = replaceCodes,
                        ErrorMessage = "UIT: Naming rule violation: argument should begin with lower case characters."
                    };
                }
            }
        }
        public void CheckConditionalStatement(ParserRuleContext context, out ErrorInformation error)
        {
            error = null;
            var  relationalExpressionContext = ((Equality_expressionContext)context).relational_expression();
            bool isBoolConditional           = (context.GetText().Contains("true") || context.GetText().Contains("false"));

            if (isBoolConditional && relationalExpressionContext.Length == 2)
            {
                List <ReplaceCodeInfomation> replaceCodes = new List <ReplaceCodeInfomation>()
                {
                    new ReplaceCodeInfomation()
                    {
                        Start       = context.Start.StartIndex,
                        Length      = context.Stop.StopIndex - context.Start.StartIndex + 1,
                        ReplaceCode = ReplaceCode(context.GetText())
                    }
                };

                error = new ErrorInformation()
                {
                    ErrorCode    = "IF0001",
                    ReplaceCode  = replaceCodes,
                    DisplayText  = "Simply statement",
                    ErrorMessage = "UIT: Bool return type in conditional statement could be simplied",
                    StartIndex   = context.Start.StartIndex,
                    Length       = context.Stop.StopIndex - context.Start.StartIndex + 1
                };
            }
        }
コード例 #3
0
        protected Exception BuildExceptionForResponse(IRestResponse response)
        {
            if (response is null)
            {
                return(new IgdbClientException(ERR_MSG_UNKNOWN));
            }

            if (response.StatusCode != 0 &&
                response.StatusCode != System.Net.HttpStatusCode.OK &&
                response.StatusCode != System.Net.HttpStatusCode.Accepted &&
                response.StatusCode != System.Net.HttpStatusCode.Created)
            {
                JsonDeserializer jsonDeserializer = new JsonDeserializer();

                ErrorInformation errorInformation = jsonDeserializer.Deserialize <List <ErrorInformation> >(response)?.FirstOrDefault();

                Exception ex = errorInformation != null && errorInformation.Status != 0
                    ? new IgdbClientBadStatusException(errorInformation)
                    : new IgdbClientBadStatusException(ERR_MSG_BAD_STATUS);

                return(ex);
            }

            return(response.IsSuccessful
                ? null
                : new IgdbClientException(response.ErrorMessage, response.ErrorException));
        }
コード例 #4
0
 public async Task Error_ERROR_on_generating_PROJECT(ErrorInformation error, string project)
 {
     await Runner.AddSteps(
         _ => Given_is_the_project(project),
         _ => When_I_generate_all_metafiles(),
         _ => Then_the_error_is_shown(error)).RunAsyncWithTimeout();
 }
コード例 #5
0
        /// <summary>
        /// Plays the prompt specified by <see cref="currentMenu"/> on the <paramref name="flow"/>.
        /// </summary>
        /// <param name="flow"><see cref="AudioVideoFlow"/> on which the prompt is to be played.</param>
        /// <returns>void; it is an <i>async</i> method.</returns>
        private async Task PlayPromptAsync(IAudioVideoFlow flow)
        {
            if (flow == null)
            {
                throw new ArgumentNullException(nameof(flow));
            }

            string resourceName = currentMenu.Prompt;

            Logger.Instance.Information("[AudioVideoIVRJob] Playing prompt : {0}.", resourceName);

            try
            {
                var resourceUri = new Uri(string.Format(azureApplication.ResourceUriFormat, resourceName));
                await flow.PlayPromptAsync(resourceUri, loggingContext).ConfigureAwait(false);
            }
            catch (CapabilityNotAvailableException ex)
            {
                Logger.Instance.Error("[AudioVideoIVRJob] PlayPrompt api is not available!", ex);
            }
            catch (RemotePlatformServiceException ex)
            {
                ErrorInformation error = ex.ErrorInformation;
                if (error != null && error.Code == ErrorCode.Informational && error.Subcode == ErrorSubcode.CallTerminated)
                {
                    Logger.Instance.Information("[AudioVideoIVRJob] Call terminated while playing prompt.");
                }
                else
                {
                    throw;
                }
            }
        }
コード例 #6
0
        public void ErrorHandler(object sender, ErrorInformation errorInformation)
        {
            var cmdlet = _cmdlet;

            if (cmdlet == null)
            {
                return;
            }

            var exceptionName = errorInformation.Exception.InnerException?.GetType().Name ?? errorInformation.Exception.GetType().Name;

            var errorMessage = $"Perry ({exceptionName}): {errorInformation.ErrorMessage}";

            if (_options?.IncludeVariable == true)
            {
                var variables = VariableParser.GetVariables(errorInformation.ErrorMessage);
                foreach (var variable in variables)
                {
                    var variableValue = cmdlet.GetVariableValue(variable).ToString();
                    errorMessage += $"{Environment.NewLine}   Variable: ${variable} = {variableValue}";
                }
            }

            if (_options?.IncludeException == true)
            {
                errorMessage += $"{Environment.NewLine}{errorInformation.Exception}";
            }

            cmdlet.WriteWarning(errorMessage);
        }
コード例 #7
0
        /// <summary>
        ///     Invokes a remote method synchronously.
        /// </summary>
        /// <typeparam name="T">Type of the return value.</typeparam>
        /// <param name="client">Client that will invoke the methpd.</param>
        /// <param name="method">Method name.</param>
        /// <param name="args">Arguments of the method.</param>
        /// <returns>Remote call's return value.</returns>
        public static T Invoke <T>(this Client client, string method, params object[] args)
        {
            var mre = new ManualResetEvent(false);

            ErrorInformation errorInfo = null;
            object           resultObj = null;

            void Callback(ErrorInformation error, object result, bool stream)
            {
                errorInfo = error;
                resultObj = result;
                mre.Set();
            }

            client.InvokeAsync(method, args, Callback);
            mre.WaitOne();

            if (errorInfo != null)
            {
                throw new RemoteException(errorInfo.Name, errorInfo.Message, errorInfo.StackTrace);
            }

            if (resultObj is T resultVal)
            {
                return(resultVal);
            }
            return(default(T));
        }
コード例 #8
0
        public void CheckError(ParserRuleContext context, out ErrorInformation error)
        {
            error = null;
            var identifierContext = ((Local_variable_declaratorContext)context).identifier();
            var currentScope      = identifierContext.Scope.GetEnclosingScope();
            var text = identifierContext.GetText();
            //check symbol exist
            var existSymbol = currentScope.Resolve(identifierContext.GetText());

            if (existSymbol != null && existSymbol.GetScope().GetName() != "local")
            {
                List <ReplaceCodeInfomation> replaceCodes = new List <ReplaceCodeInfomation>()
                {
                    new ReplaceCodeInfomation()
                    {
                        Start       = identifierContext.Start.StartIndex,
                        Length      = identifierContext.Stop.StopIndex - identifierContext.Start.StartIndex + 1,
                        ReplaceCode = identifierContext.GetText() + "1"
                    }
                };
                //warning
                error = new ErrorInformation()
                {
                    ErrorCode    = "WA0001",
                    ErrorMessage = "UIT: You should declare variable " + identifierContext.GetText() + " with difference name to avoid override value",
                    StartIndex   = identifierContext.Start.StartIndex,
                    DisplayText  = string.Format("Rename {0} to {1}", identifierContext.GetText(), replaceCodes[0].ReplaceCode),
                    ReplaceCode  = replaceCodes,
                    Length       = identifierContext.Stop.StopIndex - identifierContext.Start.StartIndex + 1
                };
            }
        }
コード例 #9
0
 internal void AddError(ErrorInformation errorInformation)
 {
     using (TimedLock lck = TimedLock.Lock(_lockObject))
     {
         _errorList.Add(errorInformation);
     }
 }
コード例 #10
0
        public void CheckConstant(ParserRuleContext context, out ErrorInformation error)
        {
            error = null;
            var identifierContext = ((Constant_declaratorContext)context).identifier();
            var identifier        = identifierContext.GetText();

            if (!IsUpperCase(identifier) || identifier[0] == '_')
            {
                List <ReplaceCodeInfomation> replaceCodes = new List <ReplaceCodeInfomation>()
                {
                    new ReplaceCodeInfomation()
                    {
                        Start       = identifierContext.Start.StartIndex,
                        Length      = identifierContext.Stop.StopIndex - context.Start.StartIndex + 1,
                        ReplaceCode = UppercaseFirst(identifier)
                    }
                };
                error = new ErrorInformation
                {
                    ErrorCode    = "IF0008",
                    StartIndex   = identifierContext.Start.StartIndex,
                    DisplayText  = string.Format("Fix name violation: {0}", replaceCodes[0].ReplaceCode),
                    ReplaceCode  = replaceCodes,
                    Length       = identifierContext.Stop.StopIndex - identifierContext.Start.StartIndex + 1,
                    ErrorMessage = "UIT: Naming rule violation: Constant should begin with upper case characters"
                };
            }
        }
コード例 #11
0
        private async Task PlayPromptAsync(IAudioVideoFlow flow, AudioVideoIVRAction action)
        {
            string wavFile = promptMap.GetOrNull(action);

            Logger.Instance.Information("[AudioVideoIVRJob] playing prompt: {0}.", wavFile);
            var resourceUri = new Uri(string.Format("{0}://{1}/resources/{2}", m_callbackUri.Scheme, m_callbackUri.Host, wavFile));

            try
            {
                await flow.PlayPromptAsync(resourceUri, m_loggingContext).ConfigureAwait(false);
            }
            catch (CapabilityNotAvailableException ex)
            {
                Logger.Instance.Error("[AudioVideoIVRJob] PlayPrompt api is not available!", ex);
            }
            catch (RemotePlatformServiceException ex)
            {
                ErrorInformation error = ex.ErrorInformation;
                if (error != null && error.Code == ErrorCode.Informational && error.Subcode == ErrorSubcode.CallTerminated)
                {
                    Logger.Instance.Information("[AudioVideoIVRJob] Call terminated while playing prompt.");
                }
                else
                {
                    throw;
                }
            }
        }
コード例 #12
0
 public void CheckNamespace(ParserRuleContext context, out ErrorInformation error)
 {
     error = null;
     IdentifierContext[] identifierContexts = ((NamespaceContext)context).qualified_identifier().identifier();
     foreach (var identifierContext in identifierContexts)
     {
         var identifier = identifierContext.GetText();
         if (!IsUpperCase(identifier))
         {
             List <ReplaceCodeInfomation> replaceCodes = new List <ReplaceCodeInfomation>()
             {
                 new ReplaceCodeInfomation()
                 {
                     Start       = identifierContext.Start.StartIndex,
                     Length      = identifierContext.Stop.StopIndex - context.Start.StartIndex + 1,
                     ReplaceCode = UppercaseFirst(identifier)
                 }
             };
             error = new ErrorInformation
             {
                 ErrorCode    = "IF0012",
                 StartIndex   = identifierContext.Start.StartIndex,
                 DisplayText  = string.Format("Fix name violation: {0}", replaceCodes[0].ReplaceCode),
                 ReplaceCode  = replaceCodes,
                 Length       = identifierContext.Stop.StopIndex - identifierContext.Start.StartIndex + 1,
                 ErrorMessage = "UIT: Naming rule violation: Namespace should begin with upper case characters"
             };
         }
     }
 }
コード例 #13
0
        // Puts a character into the DB
        // ID and character.ID are a little redundant, not sure how I feel about that
        // I figure we might want a char copy function at some point, so maybe it makes sense to
        // apply the id to the char as we put them, but I'd probably wanna figure out use cases first
        public async Task <ErrorInformation> PutCharacter(string id, Character character)
        {
            if (String.IsNullOrEmpty(id))
            {
                return(ErrorInformation.InvalidParameterError());
            }
            if (character == null)
            {
                return(ErrorInformation.InvalidParameterError());
            }

            if (id == null)
            {
                return(ErrorInformation.InvalidParameterError());
            }
            if (!id.Equals(character.Id))
            {
                return(ErrorInformation.InvalidParameterError());
            }

            ErrorInformation result = null;

            CharacterSchema characterData;

            if (CharacterExists(id))
            {
                characterData = await Characters.FindAsync(id);

                if (characterData != null)
                {
                    characterData.CharacterJsonRepresentation = JsonSerializer.Serialize(character);
                }
            }
            else
            {
                characterData = new CharacterSchema()
                {
                    Id = character.Id,
                    CharacterJsonRepresentation = JsonSerializer.Serialize(character)
                };

                Characters.Add(characterData);
            }

            try {
                await SaveChangesAsync();
            }
            catch (DbUpdateException) {
                if (CharacterExists(character.Id))
                {
                    result = ErrorInformation.DuplicateCharacterError();
                }
                else
                {
                    throw;
                }
            }

            return(result);
        }
コード例 #14
0
    public async Task <IResult <ILoginResponse> > Login(ILoginRequest login, CancellationToken cancel = default)
    {
        Result <ILoginResponse> result;

        var user = await _userManager.FindByNameAsync(login.UserName);

        if (user == null)
        {
            result = new ErrorInformation($"The user with the name  {login.UserName} was not found");
            return(result);
        }

        var loginResult = await _signInManager.CheckPasswordSignInAsync(user, login.Password, false);

        if (loginResult.Succeeded)
        {
            _logger.LogInformation("The user {0} has been successfully logged in", login.UserName);
            result = new LoginResponse()
            {
                Token = _jwtGenerator.CreateToken(user)
            };
            return(result);
        }

        _logger.LogInformation("User {0} authentication error", login.UserName);
        result = new ErrorInformation("Authentication error");
        return(result);
    }
コード例 #15
0
        protected void Application_Error(object sender, EventArgs e)
        {
            var exception = Server.GetLastError();

            if (exception == null)
            {
                return;
            }

            var errorLogger = new ErrorLoggerService(HttpContext.Current.User);

            errorLogger.InsertError(exception);

            // Clear the error
            Server.ClearError();

            var errorInformation = new ErrorInformation
            {
                Message   = "We apologize but an unexpected error occured.",
                ErrorDate = DateTime.UtcNow
            };

            Response.ClearHeaders();
            Response.ClearContent();
            Response.Status     = "500 Internal Server Error";
            Response.StatusCode = 500;
            Response.Write(JsonConvert.SerializeObject(errorInformation));
            Response.Flush();
        }
コード例 #16
0
 private void AddError(ErrorInformation error)
 {
     if (errorTable != null)
     {
         errorTable.Add(error);
     }
 }
コード例 #17
0
        public void CheckLocalVariable(ParserRuleContext context, out ErrorInformation error)
        {
            error = null;
            var identifierContext = ((Local_variable_declaratorContext)context).identifier();

            if (identifierContext != null)
            {
                _identifier = identifierContext.GetText();
                if (!IsLowerCase(_identifier) || _identifier[0] == '_')
                {
                    List <ReplaceCodeInfomation> replaceCodes = new List <ReplaceCodeInfomation>()
                    {
                        new ReplaceCodeInfomation()
                        {
                            Start       = identifierContext.Start.StartIndex,
                            Length      = identifierContext.Stop.StopIndex - context.Start.StartIndex + 1,
                            ReplaceCode = LowercaseFirst(_identifier)
                        }
                    };
                    error = new ErrorInformation
                    {
                        StartIndex   = identifierContext.Start.StartIndex,
                        ErrorCode    = "IF0005",
                        ReplaceCode  = replaceCodes,
                        DisplayText  = string.Format("Fix name violation: {0}", replaceCodes[0].ReplaceCode),
                        Length       = identifierContext.Stop.StopIndex - identifierContext.Start.StartIndex + 1,
                        ErrorMessage = "UIT: Naming rule violation: Local variable should begin with lower case characters."
                    };
                }
            }
        }
コード例 #18
0
        public void Test_NoRateLimiter_TooManyRequest_Error()
        {
            ConnectionSettings.UseRateLimiter = false;
            var connector = new CustomerConnector();

            ErrorInformation error = null;
            int i;

            for (i = 0; i < 200; i++)
            {
                connector.Search.City = TestUtils.RandomString();
                connector.Find();
                if (connector.HasError)
                {
                    error = connector.Error;
                    break;
                }
            }

            //Restore settings
            ConnectionSettings.UseRateLimiter = true;

            //Assert
            //Assert.IsTrue(failed > 0);
            Console.WriteLine($@"Succesful requests: {i}");
            Assert.IsNotNull(error);
            Assert.IsTrue(error.Message.Contains("Too Many Requests"));
        }
コード例 #19
0
ファイル: CharacterController.cs プロジェクト: rminard/dndapi
        public async Task <JsonResult> NewCharacter(Character character)
        {
            if (!validateNewCharacter(character))
            {
                return(new JsonResult(new NewCharacterResponse()
                {
                    Error = ErrorInformation.InvalidCharacterError()
                }));
            }

            NewCharacterResponse response = new NewCharacterResponse();

            ErrorInformation dbError = await _characterDbContext.PutCharacter(character.Id, character);

            if (dbError != null)
            {
                response.Error = dbError;
            }
            else
            {
                response.Character = character;
            }

            return(new JsonResult(response));
        }
コード例 #20
0
        private bool ParseResponse(string response)
        {
            JObject jo;

            try
            {
                jo = JObject.Parse(response);
            }
            catch (Exception e)
            {
                ErrorInformation.Add(e.ToString());
                return(false);
            }

            ParseId(jo);
            ParseName(jo);
            ParseCreatedAt(jo);
            ParseUpdatedAt(jo);
            ParsePasswordDigest(jo);
            ParseRememberDigest(jo);
            ParseActivatedDigest(jo);
            ParseAdmin(jo);
            ParseActivated(jo);
            ParseActivatedAt(jo);
            ParseResetDigest(jo);
            ParseResetRequestedAt(jo);

            return(true);
        }
コード例 #21
0
        private void ErrorHandler(object sender, ErrorInformation e)
        {
            if (_options == null)
            {
                return;
            }

            var client = _telemetryClient;

            if (client == null)
            {
                return;
            }

            var exception  = e.Exception.InnerException ?? e.Exception;
            var properties = new Dictionary <string, string>
            {
                { "ErrorMessage", e.ErrorMessage }
            };

            if (e.ErrorRecord != null)
            {
                properties.Add("ScriptStackTrace", e.ErrorRecord.ScriptStackTrace);
            }

            if (e.ErrorRecord?.InvocationInfo != null)
            {
                properties.Add("PSCommandPath", e.ErrorRecord.InvocationInfo.PSCommandPath);
            }

            client.TrackException(exception, properties);
        }
コード例 #22
0
        private static ErrorInformation GetExceptionHandlingInformation(HttpContext httpContext, Exception exception)
        {
            ErrorInformation errorInformation = new ErrorInformation
            {
                Exception = exception
            };

            if (exception is OrgIdMailboxRecentlyCreatedException)
            {
                OrgIdMailboxRecentlyCreatedException ex = exception as OrgIdMailboxRecentlyCreatedException;
                errorInformation.Message   = ex.Message;
                errorInformation.MessageId = new Strings.IDs?(ex.ErrorMessageStringId);
                errorInformation.AddMessageParameter(ex.UserName);
                errorInformation.AddMessageParameter(ex.HoursBetweenAccountCreationAndNow.ToString());
                errorInformation.Mode = ex.ErrorMode;
            }
            else if (exception is OrgIdMailboxNotFoundException)
            {
                OrgIdMailboxNotFoundException ex2 = exception as OrgIdMailboxNotFoundException;
                errorInformation.Message   = ex2.Message;
                errorInformation.MessageId = new Strings.IDs?(ex2.ErrorMessageStringId);
                errorInformation.AddMessageParameter(ex2.UserName);
                errorInformation.Mode = ex2.ErrorMode;
            }
            else if (exception is OrgIdLogonException)
            {
                OrgIdLogonException ex3 = exception as OrgIdLogonException;
                errorInformation.Message          = ex3.Message;
                errorInformation.MessageId        = new Strings.IDs?(ex3.ErrorMessageStringId);
                errorInformation.MessageParameter = ex3.UserName;
            }
            else if (exception is AppPasswordAccessException)
            {
                AppPasswordAccessException ex4 = exception as AppPasswordAccessException;
                errorInformation.Message   = ex4.Message;
                errorInformation.MessageId = new Strings.IDs?(ex4.ErrorMessageStringId);
            }
            else if (exception is LiveClientException || exception is LiveConfigurationException || exception is LiveTransientException || exception is LiveOperationException)
            {
                errorInformation.Message   = exception.Message;
                errorInformation.MessageId = new Strings.IDs?(1317300008);
                string text = httpContext.Request.QueryString["realm"];
                if (!string.IsNullOrEmpty(text))
                {
                    errorInformation.AddMessageParameter(text);
                }
            }
            else if (exception is AccountTerminationException)
            {
                AccountTerminationException ex5 = exception as AccountTerminationException;
                errorInformation.Message          = ex5.Message;
                errorInformation.MessageId        = new Strings.IDs?(ex5.ErrorMessageStringId);
                errorInformation.MessageParameter = ex5.AccountState.ToString();
            }
            return(errorInformation);
        }
コード例 #23
0
        public void CheckField(ParserRuleContext context, out ErrorInformation error)
        {
            error = null;
            var identifierContext = ((Field_declarationContext)context).variable_declarators().variable_declarator()[0].identifier();
            var identifier        = identifierContext.GetText();
            var varSymbol         = identifierContext.Symbol as FieldSymbol;

            if (varSymbol.HaveModifier("private") || varSymbol.HaveModifier("internal"))
            {
                if (!IsUnderScoreAndLowerCase(identifier))
                {
                    List <ReplaceCodeInfomation> replaceCodes = new List <ReplaceCodeInfomation>()
                    {
                        new ReplaceCodeInfomation()
                        {
                            Start       = identifierContext.Start.StartIndex,
                            Length      = identifierContext.Stop.StopIndex - context.Start.StartIndex + 1,
                            ReplaceCode = string.Format("_{0}", LowercaseFirst(identifier))
                        }
                    };
                    error = new ErrorInformation
                    {
                        ErrorCode    = "IF0007",
                        DisplayText  = string.Format("Fix name violation: {0}", replaceCodes[0].ReplaceCode),
                        StartIndex   = identifierContext.Start.StartIndex,
                        ReplaceCode  = replaceCodes,
                        Length       = identifierContext.Stop.StopIndex - identifierContext.Start.StartIndex + 1,
                        ErrorMessage = "UIT: Naming rule violation: private, internal field member should be begin with _ and lower case character"
                    };
                }
            }
            else if ((varSymbol.HaveModifier("public") || varSymbol.HaveModifier("protected")))
            {
                if (!IsUpperCase(identifier))
                {
                    List <ReplaceCodeInfomation> replaceCodes = new List <ReplaceCodeInfomation>()
                    {
                        new ReplaceCodeInfomation()
                        {
                            Start       = identifierContext.Start.StartIndex,
                            Length      = identifierContext.Stop.StopIndex - context.Start.StartIndex + 1,
                            ReplaceCode = UppercaseFirst(identifier)
                        }
                    };
                    error = new ErrorInformation
                    {
                        ErrorCode    = "IF0011",
                        StartIndex   = identifierContext.Start.StartIndex,
                        DisplayText  = string.Format("Fix name violation: {0}", replaceCodes[0].ReplaceCode),
                        ReplaceCode  = replaceCodes,
                        Length       = identifierContext.Stop.StopIndex - identifierContext.Start.StartIndex + 1,
                        ErrorMessage = "UIT: Naming rule violation: public, protected Field member should be begin with uppercase character "
                    };
                }
            }
        }
コード例 #24
0
 private void ParsePasswordDigest(JObject jo)
 {
     try
     {
         PasswordDigest = (string)jo.SelectToken("password_digest");
     }
     catch (Exception e)
     {
         ErrorInformation.Add(e.ToString());
     }
 }
コード例 #25
0
 private void ParseResetDigest(JObject jo)
 {
     try
     {
         ResetDigest = (string)jo.SelectToken("reset_digest");
     }
     catch (Exception e)
     {
         ErrorInformation.Add(e.ToString());
     }
 }
コード例 #26
0
 private void ParseActivated(JObject jo)
 {
     try
     {
         Activated = (bool)jo.SelectToken("activated");
     }
     catch (Exception e)
     {
         ErrorInformation.Add(e.ToString());
     }
 }
コード例 #27
0
 private void ParseAdmin(JObject jo)
 {
     try
     {
         Admin = (bool)jo.SelectToken("admin");
     }
     catch (Exception e)
     {
         ErrorInformation.Add(e.ToString());
     }
 }
コード例 #28
0
 private void ParseActivatedDigest(JObject jo)
 {
     try
     {
         ActivationDigest = (string)jo.SelectToken("activation_digest");
     }
     catch (Exception e)
     {
         ErrorInformation.Add(e.ToString());
     }
 }
コード例 #29
0
 private void ParseName(JObject jo)
 {
     try
     {
         Name = (string)jo.SelectToken("name");
     }
     catch (Exception e)
     {
         ErrorInformation.Add(e.ToString());
     }
 }
コード例 #30
0
 private void CaptureCounterExamples(ErrorInformation errorInfo)
 {
     if (errorInfo.Model is StringWriter modelString)
     {
         // We do not know a-priori how many errors we'll receive. Therefore we capture all models
         // in a custom stringbuilder and reset the original one to not duplicate the outputs.
         serializedCounterExamples ??= new StringBuilder();
         serializedCounterExamples.Append(modelString.ToString());
         modelString.GetStringBuilder().Clear();
     }
 }
コード例 #31
0
        protected override void OnError(ErrorInformation errorInformation)
        {
            string msg = string.Format(errorInformation.Message, errorInformation.Arguments.ToArray());

            throw new ParserErrorException(errorInformation.Location.Span.Start.Line,
                errorInformation.Location.Span.Start.Column,
                errorInformation.Location.Span.Length,
                msg);

            //throw new FormatException(
            //    string.Format("Syntax error at [{0}, {1}]: {2}",
            //    errorInformation.Location.Span.Start.Line,
            //    errorInformation.Location.Span.Start.Column,
            //    msg));
        }
コード例 #32
0
ファイル: OsloErrorReporter.cs プロジェクト: st9200/soal-oslo
 protected override void OnError(ErrorInformation errorInformation)
 {
     this.Errors.Add(errorInformation);
 }
コード例 #33
0
 public ParserErrorException(ISourceLocation location, ErrorInformation information)
 {
     Error = information;
     Location = location;
 }
コード例 #34
0
ファイル: ToDoMode.cs プロジェクト: m4dc4p/mg-todo
 protected override void OnError(ErrorInformation errorInformation)
 {
     Errors.Add(new ErrorInfo { Location = errorInformation.Location, Info = errorInformation });
 }
コード例 #35
0
 protected override void OnError(ErrorInformation errorInformation)
 {
     throw new ParserErrorException(errorInformation.Location, errorInformation);
 }
コード例 #36
0
ファイル: ToDoMode.cs プロジェクト: dcoellar/mg-todo
 protected override void OnError(ISourceLocation sourceLocation, ErrorInformation errorInformation)
 {
     Errors.Add(new ErrorInfo { Location = sourceLocation, Info = errorInformation });
 }