public InvalidCommandProblemDetails(InvalidCommandException exception)
 {
     Title  = "Command validation error";
     Status = StatusCodes.Status400BadRequest;
     Type   = "https://somedomain/validation-error";
     Errors = exception.Errors;
 }
Esempio n. 2
0
 public InvalidCommandProblemDetails(InvalidCommandException exception)
 {
     this.Title  = exception.Message;
     this.Status = StatusCodes.Status400BadRequest;
     this.Detail = exception.Details;
     this.Type   = "https://somedomain/validation-error";
 }
 public InvalidCommandProblemDetails(InvalidCommandException exception)
 {
     Title  = "Command validation error";
     Status = StatusCodes.Status400BadRequest;
     Type   = exception.GetType().ToString();
     Errors = exception.Errors;
 }
 public InvalidCommandProblemDetails(InvalidCommandException exception)
 {
     this.Title  = exception.Message;
     this.Status = StatusCodes.Status400BadRequest;
     this.Detail = exception.Details;
     this.Type   = "https://httpstatuses.com/" + this.Status;
 }
Esempio n. 5
0
        /// <summary>
        /// Asks the user to confirm the specified <see cref="InvalidCommandException"/>.</summary>
        /// <param name="exception">
        /// The <see cref="InvalidCommandException"/> to confirm.</param>
        /// <returns>
        /// <c>true</c> if the user confirms that the command replay should continue in spite of the
        /// specified <paramref name="exception"/>; otherwise, <c>false</c>.</returns>
        /// <remarks>
        /// <b>ConfirmCommandError</b> conforms to the <see cref="ConfirmCommandErrorCallback"/>
        /// delegate for cross-thread invocations.</remarks>

        private bool ConfirmCommandError(InvalidCommandException exception)
        {
            string message = String.Format(ApplicationInfo.Culture,
                                           Global.Strings.DialogCommandResume, MasterSection.Instance.Path);

            bool?result = MessageDialog.Show(this, message,
                                             Global.Strings.TitleCommandInvalid, exception,
                                             MessageBoxButton.OKCancel, Images.Error);

            return(result == true);
        }
        public void Serialize()
        {
            string message = "Invalid command";
            string commandName = "CMDUNKNOWN";
            InvalidCommandException invalidCommandException = new InvalidCommandException(message, commandName);

            using (Stream memory = new MemoryStream())
            {
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Serialize(memory, invalidCommandException);
                memory.Position = 0; // Reset stream position
                invalidCommandException = (InvalidCommandException)formatter.Deserialize(memory);
            }

            Assert.IsNotNull(invalidCommandException, "InvalidCommandException object was not serialized properly.");
            Assert.AreEqual(message, invalidCommandException.Message);
            Assert.AreEqual(commandName ,invalidCommandException.InvalidCommandName);
        }
 public InvalidCommandRuleValidationExceptionProblemDetails(InvalidCommandException exception)
 {
     Status = StatusCodes.Status400BadRequest;
     Type   = nameof(InvalidCommandRuleValidationExceptionProblemDetails);
     Errors = ProblemDetailsWrapErrors.GetErrors(exception.Errors);
 }
Esempio n. 8
0
 public ValidationResultModel(InvalidCommandException ice)
 {
     Message = ValidationErrorMessage;
     Errors  = ice.Errors.Keys.SelectMany(key => DoValidation(key, ice.Errors[key])).ToList();
 }
Esempio n. 9
0
        public void Should_AssignMaxDepth()
        {
            var ex = new InvalidCommandException("test");

            Assert.Equal("test", ex.Message);
        }
Esempio n. 10
0
        /// <summary>
        /// Shows an error message for the specified <see cref="InvalidCommandException"/>.
        /// </summary>
        /// <param name="exception">
        /// An <see cref="InvalidCommandException"/> that occurred during command replay.</param>
        /// <remarks>
        /// <b>ShowError</b> shows a <see cref="MessageDialog"/> with the specified <paramref
        /// name="exception"/> and a note that replay has been stopped.</remarks>

        private static void ShowCommandError(InvalidCommandException exception)
        {
            AsyncAction.Invoke(() => MessageDialog.Show(MainWindow.Instance,
                                                        Global.Strings.DialogReplayError, Global.Strings.TitleReplayError,
                                                        exception, MessageBoxButton.OK, Images.Error));
        }
 public InvalidCommandProblemDetails(InvalidCommandException exception)
 {
     this.Title  = exception.Message;
     this.Status = StatusCodes.Status400BadRequest;
     this.Detail = exception.Details;
 }