/// <summary>
 /// Throws the exception if the application response contains a error, warning and/or message which matches the specified type.
 /// </summary>
 /// <param name="errorType">Expected error type.</param>
 public void ThrowForKnownWarning(KnownError errorType)
 {
     if (HasKnownError(errorType, false))
     {
         throw this;
     }
 }
Esempio n. 2
0
        private async void button4_Click(object sender, EventArgs e)
        {
            var selectedError = SelectedUnknownError;

            if (selectedError != null && textBox3.Text != "" && SelectedStatusError != null)
            {
                var txtAnswer = textBox3.Text;
                var answer    = new Answer()
                {
                    Id   = ObjectId.GenerateNewId(),
                    Text = txtAnswer
                };

                var bsonValue  = BsonDocument.Parse(answer.ToJson());
                var bsonStatus = BsonDocument.Parse(SelectedStatusError.ToJson());

                var knowError = new KnownError()
                {
                    Message = selectedError.ErrorText,
                    Error   = selectedError.Error,
                    Answer  = bsonValue,
                    Status  = bsonStatus
                };

                await DataProcessor.SaveKnownErrorsIntoDb(knowError);

                var filter1 = Builders <BsonDocument> .Filter.Eq("Text", answer.Text);

                var answers = await DataProcessor.GetDataFind(filter1, "Answers", 0, Int32.MaxValue);

                if (!answers.Any())
                {
                    await DataProcessor.SaveAnswerIntoDb(answer);
                }

                var filter2 = Builders <BsonDocument> .Filter.Eq("_id", selectedError.Id);

                await DataProcessor.DeleteDocument(filter2, "UnKnownError");

                LoadData();

                textBox3.Clear();
                label9.Text         = "Code";
                label10.Text        = "Title";
                SelectedStatusError = null;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// создаем не извесные ошибки
        /// </summary>
        private static void CreateUnKnownError(Error error)
        {
            var index = error.Message.IndexOf(".'");
            var sms   = index >= 0 ? error.Message.Substring(0, index) : error.Message;

            IEnumerable <string> arrError = sms.Trim().Split(' ');

            UnKnownError findUnKnownError = null;
            KnownError   findKnownError   = null;

            string message = "";

            foreach (var err in arrError)
            {
                int res;
                var dd = Int32.TryParse(err, out res);
                if (err.IndexOf("'") < 0 && res == 0)
                {
                    message += err + " ";
                }
            }

            findUnKnownError = unKnownErrorsList.Find(o => o.ErrorText == message.TrimEnd());
            findKnownError   = knownErrorsList.Find(o => o.Message == message.TrimEnd());

            if (findUnKnownError == null && findKnownError == null)
            {
                var unError = new UnKnownError()
                {
                    ErrorText    = message.TrimEnd(),
                    Error        = error.ResponsError,
                    CountFounded = 1
                };

                unKnownErrorsList.Add(unError);
            }
            else if (findUnKnownError != null)
            {
                findUnKnownError.CountFounded++;
                if (findUnKnownError.Id != ObjectId.Empty)
                {
                    findUnKnownError.IsModified = true;
                }
            }
        }
Esempio n. 4
0
        public BLException(KnownError blerrortype)
        {
            switch (blerrortype)
            {
            case KnownError.InvalidInitialBalance:
                blmessage = "Failed to Create Account. Invalid Initial Balance.";
                break;

            case KnownError.InvalidUsername:
                blmessage = "Failed to Create Account. Invalid Username.";
                break;

            case KnownError.UsernameExists:
                blmessage = "Failed to Create Account. Username exists.";
                break;

            case KnownError.InvalidTransferAmount:
                blmessage = "Transfer Failed. Invalid Amount.";
                break;

            case KnownError.InvalidSource:
                blmessage = "Transfer Failed. Invalid Source Account.";
                break;

            case KnownError.InvalidDestination:
                blmessage = "Transfer Failed. Invalid Destination Account.";
                break;

            case KnownError.DALError_ReturnsIncorrectAccountId:
                blmessage = "DB error. Unexpected result for AccountId. Please contact your System Admin.";
                break;

            case KnownError.DALError_ReturnsIncorrectTransactionId:
                blmessage = "DB error. Unexpected result for TransactionId. Please contact your System Admin.";
                break;
            }
        }
		public bool IsKnownError(KnownError knownError)
		{
			return (int)errorCode == (int)knownError;
		}
Esempio n. 6
0
 /// <summary>
 /// сохраннение KnownError обьектов
 /// </summary>
 public static async Task SaveKnownErrorsIntoDb(KnownError knownError)
 {
     await db.SaveKnownErrors(knownError);
 }
Esempio n. 7
0
 public async Task SaveKnownErrors(KnownError knownError)
 {
     var collection = GetKnownErrors();
     await collection.InsertOneAsync(knownError);
 }
Esempio n. 8
0
 public bool IsKnownError(KnownError knownError)
 {
     return((int)errorCode == (int)knownError);
 }
Esempio n. 9
0
 public SearchException(KnownError error, Exception innerException) : base(error.ToString(), innerException)
 {
     this.Error      = error;
     this.Parameters = new List <object>();
 }
Esempio n. 10
0
 public SearchException(KnownError error, params object[] parameters)
 {
     this.Error      = error;
     this.Parameters = new List <object>();
     this.Parameters.AddRange(parameters);
 }
Esempio n. 11
0
 public SearchException(KnownError error)
 {
     this.Error      = error;
     this.Parameters = new List <object>();
 }
 /// <summary>
 /// Throws the exception if the application response contains a error, warning and/or message which matches the specified type.
 /// </summary>
 /// <param name="errorType">Expected error type.</param>
 public void ThrowForKnownWarning(KnownError errorType)
 {
     if (HasKnownError(errorType, false))
     {
         throw this;
     }
 }
Esempio n. 13
0
        /// <summary>
        /// создаем не извесные ошибки
        /// </summary>
        private static void CreateUnKnownError(Error error)
        {
            var index = error.Message.IndexOf(".'");
            var sms   = index >= 0 ? error.Message.Substring(0, index) : error.Message;

            IEnumerable <string> arrError = sms.Trim().Split(' ');

            UnKnownError findUnKnownError = null;
            KnownError   findKnownError   = null;

            string message = "";

            foreach (var err in arrError)
            {
                int res;
                var dd = Int32.TryParse(err, out res);
                if (err.IndexOf("'") < 0 && res == 0)
                {
                    message += err + " ";
                }
            }

            findUnKnownError = unKnownErrorsList.Find(o => o.ErrorText == message.TrimEnd());
            findKnownError   = knownErrorsList.Find(o => o.Message == message.TrimEnd());

            if (findUnKnownError == null && findKnownError == null)
            {
                var unError = new UnKnownError()
                {
                    ErrorText    = message.TrimEnd(),
                    Error        = error.ResponsError,
                    CountFounded = 1
                };

                unKnownErrorsList.Add(unError);
            }
            else if (findUnKnownError != null)
            {
                findUnKnownError.CountFounded++;
                if (findUnKnownError.Id != ObjectId.Empty)
                {
                    findUnKnownError.IsModified = true;
                }
            }
            else if (findKnownError != null)
            {
                var existOffer = offerAnswers.Find(o => o.Message == findKnownError.Message);
                if (existOffer == null)
                {
                    var st = BsonSerializer.Deserialize <StatusError>(findKnownError.Status.ToJson());
                    var an = BsonSerializer.Deserialize <Answer>(findKnownError.Answer.ToJson());

                    var knowView = new KnownErrorView()
                    {
                        Message     = findKnownError.Message,
                        Count       = 1,
                        StatusCode  = st.StatusCode,
                        StatusTitle = st.StatusTitle,
                        Answer      = an.Text
                    };

                    offerAnswers.Add(knowView);
                }
                else
                {
                    existOffer.Count++;
                }
            }
        }
Esempio n. 14
0
 public void AddKnowErrorToOffer(KnownError knownError)
 {
     _offerKnownError.Add(knownError);
 }
Esempio n. 15
0
File: Chunk.cs Progetto: sgf/SCTP
        protected VariableParam readErrorParam()
        {
            int type = _body.GetUShort();
            int len  = _body.GetUShort();
            int blen = len - 4;

            byte[]     data;
            KnownError var = null;

            switch (type)
            {
            case 1:
                var = new KnownError(1, "InvalidStreamIdentifier");
                break;                        //[RFC4960]

            case 2:
                var = new KnownError(2, "MissingMandatoryParameter");
                break;                        //[RFC4960]

            case 3:
                var = new StaleCookieError();
                break;                        //[RFC4960]

            case 4:
                var = new KnownError(4, "OutofResource");
                break;                        //[RFC4960]

            case 5:
                var = new KnownError(5, "UnresolvableAddress");
                break;                        //[RFC4960]

            case 6:
                var = new KnownError(6, "UnrecognizedChunkType");
                break;                        //[RFC4960]

            case 7:
                var = new KnownError(7, "InvalidMandatoryParameter");
                break;                        //[RFC4960]

            case 8:
                var = new KnownError(8, "UnrecognizedParameters");
                break;                        //[RFC4960]

            case 9:
                var = new KnownError(9, "NoUserData");
                break;                        //[RFC4960]

            case 10:
                var = new KnownError(10, "CookieReceivedWhileShuttingDown");
                break;                        //[RFC4960]

            case 11:
                var = new KnownError(11, "RestartofanAssociationwithNewAddresses");
                break;                        //[RFC4960]

            case 12:
                var = new KnownError(12, "UserInitiatedAbort");
                break;                        //[RFC4460]

            case 13:
                var = new ProtocolViolationError(13, "ProtocolViolation");
                break;                        //[RFC4460]

            // 14-159,Unassigned,
            case 160:
                var = new KnownError(160, "RequesttoDeleteLastRemainingIPAddress");
                break;                        //[RFC5061]

            case 161:
                var = new KnownError(161, "OperationRefusedDuetoResourceShortage");
                break;                        //[RFC5061]

            case 162:
                var = new KnownError(162, "RequesttoDeleteSourceIPAddress");
                break;                        //[RFC5061]

            case 163:
                var = new KnownError(163, "AssociationAbortedduetoillegalASCONF-ACK");
                break;                        //[RFC5061]

            case 164:
                var = new KnownError(164, "Requestrefused-noauthorization");
                break;                        //[RFC5061]

            // 165-260,Unassigned,
            case 261:
                var = new KnownError(261, "UnsupportedHMACIdentifier");
                break;                        //[RFC4895]
                // 262-65535,Unassigned,
            }
            try {
                var.readBody(_body, blen);
                Logger.Trace("variable type " + var.getType() + " name " + var.getName());
                Logger.Trace("additional info " + var.ToString());
            }
            catch (SctpPacketFormatException ex) {
                Logger.Error(ex.ToString());
            }
            if (_body.hasRemaining())
            {
                int mod = blen % 4;
                if (mod != 0)
                {
                    for (int pad = mod; pad < 4; pad++)
                    {
                        _body.GetByte();
                    }
                }
            }
            return(var);
        }
Esempio n. 16
0
 public ErrorChunk(KnownError e) : this()
 {
     _varList.Add(e);
 }