csharp/adamralph/simple-exec/SimpleExec/ExitCodeReadException.cs

ExitCodeReadException.cs
using System;

namespace SimpleExec
{
    /// 
    /// The command being read exited with an unexpected exit code.
    /// 
#pragma warning disable CA1032 // Implement standard exception constructors
    public clast ExitCodeReadException : ExitCodeException
#pragma warning restore CA1032 // Implement standard exception constructors
    {
        private static readonly string twoNewLines = $"{Environment.NewLine}{Environment.NewLine}";

        /// 
        /// Constructs an instance of a .
        /// 
        /// The exit code of the command.
        /// The contents of standard output (stdour).
        /// The contents of standard error (stderr).
        public ExitCodeReadException(int exitCode, string standardOutput, string standardError) : base(exitCode) => (this.StandardOutput, this.StandardError) = (standardOutput, standardError);

        /// 
        /// Gets the contents of standard output (stdout).
        /// 
        public string StandardOutput { get; }

        /// 
        /// Gets the contents of standard error (stderr).
        /// 
        public string StandardError { get; }

        /// 
        public override string Message =>
            $"{base.Message}{twoNewLines}Standard output (stdout):{twoNewLines}{this.StandardOutput}{twoNewLines}Standard error (stderr):{twoNewLines}{this.StandardError}";
    }
}