AddWrapperExceptions() 공개 메소드

Adds a list of outer exceptions that will be stripped, leaving only the valuable inner exception. This can be used when a wrapper exception, e.g. TargetInvocationException or AggregateException, contains the actual exception as the InnerException. The message and stack trace of the inner exception will then be used by Raygun for grouping and display. The above two do not need to be added manually, but if you have other wrapper exceptions that you want stripped you can pass them in here.
public AddWrapperExceptions ( ) : void
리턴 void
예제 #1
0
 public static RaygunClient GetClient()
 {
     var assemblyInfo = typeof(App).Assembly.GetAttribute<AssemblyInformationalVersionAttribute>();
     var client = new RaygunClient("uX5c/PiCVqF31xlEm3jShA==")
     {
         ApplicationVersion = assemblyInfo != null ? assemblyInfo.InformationalVersion : "Unknown Version"
     };
     client.AddWrapperExceptions(typeof(AggregateException));
     return client;
 }
예제 #2
0
        /// <summary>
        /// Construct a sink that saves errors to the Raygun.io service. Properties are being send as userdata and the level is used as tag. The message is included inside the userdata.
        /// </summary>
        /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
        /// <param name="applicationKey">The application key as found on the Raygun website.</param>
        /// <param name="wrapperExceptions">If you have common outer exceptions that wrap a valuable inner exception which you'd prefer to group by, you can specify these by providing a list.</param>
        /// <param name="userNameProperty">Specifies the property name to read the username from. By default it is UserName. Set to null if you do not want to use this feature.</param>
        /// <param name="applicationVersionProperty">Specifies the property to use to retrieve the application version from. You can use an enricher to add the application version to all the log events. When you specify null, Raygun will use the assembly version.</param>
        public RaygunSink(IFormatProvider formatProvider, string applicationKey, IEnumerable<Type> wrapperExceptions = null, string userNameProperty = "UserName", string applicationVersionProperty = "ApplicationVersion")
        {
            if (string.IsNullOrEmpty(applicationKey))
                throw new ArgumentNullException("applicationKey");

            _formatProvider = formatProvider;
            _userNameProperty = userNameProperty;
            _applicationVersionProperty = applicationVersionProperty;

            _client = new RaygunClient(applicationKey);
            if (wrapperExceptions != null)
                _client.AddWrapperExceptions(wrapperExceptions);
        }