Skip to content

Commit e506c27

Browse files
committed
chore: fixes
1 parent a6afbd5 commit e506c27

File tree

10 files changed

+22
-18
lines changed

10 files changed

+22
-18
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,6 @@ The workflow does the following:
169169

170170
_Note: only users with write permissions can trigger this workflow (i.e. Collaborators)._
171171

172-
## Known bugs
173-
174-
- [ ] Always shows "Honeybadger.HoneybadgerClient" when reporting a notice with a message
175-
176172
## TODO
177173

178174
- [ ] Publish README with basic info to setup core nuget

examples/Honeybadger.Console/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
.Bind(options);
1616

1717
var client = new HoneybadgerClient(Options.Create(options));
18-
client.Notify("hello from .Net !");
18+
client.Notify("Hello from .Net! Improved error handling with Honeybadger.");
1919
Console.WriteLine("Done. Check your Honeybadger dashboard for the error.");

examples/Honeybadger.Console/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
}
88
},
99
"Honeybadger": {
10-
"ApiKey": "your_api_key",
10+
"ApiKey": "api_key",
1111
"AppEnvironment": "development",
1212
"ReportData": true
1313
}

examples/Honeybadger.DotNetCoreWebApp.Logger/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
app.MapGet("/", () => "Hello World!");
99
app.MapGet("/notify", ([FromServices] ILogger<Program> logger) =>
1010
{
11-
logger.LogError("hello from Honeybadger.Logger!");
11+
logger.LogError("Hello from Honeybadger.Logger! Improved error handling with Honeybadger.");
1212

1313
return "Log reported to Honeybadger. Check your dashboard!";
1414
});

examples/Honeybadger.DotNetCoreWebApp.Logger/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"Microsoft.AspNetCore": "Warning"
66
},
77
"Honeybadger": {
8-
"ApiKey": "your_api_key",
8+
"ApiKey": "api_key",
99
"AppEnvironment": "development",
1010
"ReportData": true
1111
}

examples/Honeybadger.DotNetCoreWebApp/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
});
1414
app.MapGet("/debug", () =>
1515
{
16-
throw new Exception("hello from .Net Core Web App!");
16+
throw new Exception("Hello from .Net Core Web App! Improved error handling with Honeybadger.");
1717
});
1818

1919
app.Run();

examples/Honeybadger.DotNetCoreWebApp/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"AllowedHosts": "*",
99
"Honeybadger": {
10-
"ApiKey": "your_api_key",
10+
"ApiKey": "api_key",
1111
"AppEnvironment": "development",
1212
"ReportData": true
1313
}

src/Honeybadger.DotNetCore/HoneybadgerMiddleware.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public async Task Invoke(HttpContext context, IHoneybadgerClient client)
1818
// needed for HoneybadgerStartupFilter.cs
1919
context.Items[HttpContextItemsKey] = client;
2020

21-
if (client.Options.ShouldReport())
21+
if (!client.Options.ShouldReport())
2222
{
2323
await _next(context);
2424
return;

src/Honeybadger.Extensions.Logging/HoneybadgerLogger.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
3939
if (exception is null)
4040
{
4141
var notice = formatter(state, exception);
42-
_client.Notify(notice);
42+
_client.NotifyAsync(notice).ConfigureAwait(false);
4343
}
4444
else
4545
{
46-
_client.Notify(exception);
46+
_client.NotifyAsync(exception).ConfigureAwait(false);
4747
}
4848
}
4949
}

src/Honeybadger/NoticeHelpers/NoticeFactory.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Diagnostics;
2+
using System.Security.Cryptography;
23
using Honeybadger.Schema;
34

45
namespace Honeybadger.NoticeHelpers;
@@ -16,13 +17,20 @@ public static class NoticeFactory
1617
public static Notice Make(IHoneybadgerClient client, string message, Dictionary<string, object>? context = null)
1718
{
1819
var stackTrace = new StackTrace(1, true);
19-
var isFirstFrameInternal =
20-
stackTrace.GetFrame(0)?.GetMethod()?.DeclaringType?.FullName?.Contains("HoneybadgerClient");
21-
if (isFirstFrameInternal.HasValue && isFirstFrameInternal.Value)
20+
// do while loop to skip internal frames
21+
var frameIndex = 0;
22+
var isFrameInternal = true;
23+
while (isFrameInternal)
2224
{
23-
stackTrace = new StackTrace(2, true);
25+
isFrameInternal = stackTrace.GetFrame(frameIndex)?
26+
.GetMethod()?
27+
.DeclaringType?.FullName?
28+
.Contains("Honeybadger") ?? false;
29+
30+
frameIndex++;
2431
}
25-
32+
stackTrace = new StackTrace(frameIndex, true);
33+
2634
return Make(client, message, stackTrace, context: context);
2735
}
2836

0 commit comments

Comments
 (0)