/// <summary> /// Creates a exception information payload based on an exception /// </summary> /// <param name="exception">The exception to base the payload on</param> /// <param name="callTrace">The call stack trace, or null if its not available</param> /// <param name="config">The configuration to use</param> /// <returns>The exception information payload to use in the notification</returns> public static ExceptionInfo GenerateExceptionInfo(Exception exception, string callTrace, Configuration config) { if (exception == null) return null; // StackTrace trace = null; // // // Attempt to get stack frame from exception, if the stack trace is invalid, // // try to use the call stack trace // trace = new StackTrace(exception, true); // if (trace == null || trace.FrameCount == 0) // { // // If we still don't have a stack trace we can use, give up and return // if (callTrace == null || callTrace.FrameCount == 0) // return null; // // trace = callTrace; // } // // Attempt to get the stack frames // var frames = trace.GetFrames(); // if (frames == null) // return null; // Convert the frames to stack frame payloads // var stackFrameInfos = frames.Select(x => GenerateStackTraceFrameInfo(x, config)) // .Where(x => !x.Method.StartsWith("Bugsnag.")).ToList(); return new ExceptionInfo { ExceptionClass = exception.GetType().Name, Description = exception.Message, StackTrace = GenerateStackTraceInfo(callTrace).ToList() }; }
public NotificationFactory(Configuration config) { Config = config; }
public Notifier(Configuration config) { Config = config; Factory = new NotificationFactory(config); }