C#: Overriding ToString() method for custom exceptions
This is all overkill. Your exception should just override the Message Property. public override String Message { get { return base.Message + String.Format(“, HttpStatusCode={0}, RequestId='{1}'”, httpStatusCode, RequestId); } } The default ToString method for the Exception class is basically “ClassName: Message –> InnerException.ToString() StackTrace“. So overriding the Message puts your message text exactly where it … Read more