예제 #1
0
        /// <summary>
        /// Creates a builder object for constructing error reports in a fluent api.
        /// </summary>
        /// <param name="exception">The exception.</param>
        /// <param name="addDefaultInformation">Wether the default information should be included in the report.</param>
        /// <param name="pluginContextData">
        /// Any contextual data objects to be used by Exceptionless plugins to gather default
        /// information for inclusion in the report information.
        /// </param>
        /// <param name="client">
        /// The ExceptionlessClient instance used for configuration. If a client is not specified, it will use
        /// ExceptionlessClient.Current.
        /// </param>
        /// <returns></returns>
        public static ErrorBuilder ToExceptionless(this Exception exception, bool addDefaultInformation, IDictionary <string, object> pluginContextData = null, ExceptionlessClient client = null)
        {
            if (client == null)
            {
                client = ExceptionlessClient.Current;
            }
            var builder = new ErrorBuilder(ExceptionlessClient.ToError(client, exception));

            return(addDefaultInformation ? builder.AddDefaultInformation(pluginContextData) : builder);
        }