using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
namespace System {
/// <summary>
/// this Exception is not meant to be handled. Only for logging and debugging-purposes
/// </summary>
[Serializable]
public class BugException : Exception {
public BugException(string message) : base(message) { }
protected BugException(SerializationInfo info, StreamingContext context)
: base(info, context) { }
public BugException(string message, Exception innerException)
: base(message, innerException) { }
}
public static class BugExceptionX {
// these extensions automatically add type-informations to the messages. Furthermore they concat
//�lists of anything to the message
public static BugException BugException<T>(
this T sender, params string[] messages) where T : class {
return new BugException(string.Concat(sender.ToString(), "\n", string.Concat(messages)));
}
public static BugException BugException<T>(
this T sender, Exception innerEx, params string[] messages) where T : class {
return new BugException(
string.Concat(sender.ToString(), "\n", string.Concat(messages)),
innerEx);
}
}
}