/// <summary> /// Post an Exception to BugSplat /// </summary> /// <param name="stackTrace">A string representation of an Exception's stack trace</param> /// <param name="options">Optional parameters that will override the defaults if provided</param> public async Task <HttpResponseMessage> Post(string stackTrace, ExceptionPostOptions options = null) { ThrowIfArgumentIsNull(stackTrace, "stackTrace"); using (var httpClient = new HttpClient()) { options = options ?? new ExceptionPostOptions(); var uri = new Uri($"{baseUrl}/post/dotnetstandard/"); var body = CreateMultiPartFormDataContent(options); var crashTypeId = options?.ExceptionType != ExceptionTypeId.Unknown ? options.ExceptionType : ExceptionType; body.Add(new StringContent(stackTrace), "callstack"); body.Add(new StringContent($"{(int)crashTypeId}"), "crashTypeId"); return(await httpClient.PostAsync(uri, body)); } }
/// <summary> /// Post an Exception to BugSplat /// </summary> /// <param name="ex">The Exception that will be serialized and posted to BugSplat</param> /// <param name="options">Optional parameters that will override the defaults if provided</param> public async Task <HttpResponseMessage> Post(Exception ex, ExceptionPostOptions options = null) { ThrowIfArgumentIsNull(ex, "ex"); return(await Post(ex.ToString(), options)); }