File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
src/Honeybadger/NoticeHelpers Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ public static class ErrorFactory
7
7
{
8
8
public static Error Get ( StackTrace stackTrace , string message , string ? className = null )
9
9
{
10
- var @class = className ?? stackTrace . GetFrame ( 0 ) ? . GetMethod ( ) ? . DeclaringType ? . FullName ?? "CLASS" ;
10
+ var @class = className ?? stackTrace . GetFrame ( 0 ) ? . GetMethod ( ) ? . DeclaringType ? . FullName ?? "CLASS" ;
11
11
return new Error ( @class , message , GetBacktraces ( stackTrace ) )
12
12
{
13
13
Fingerprint = null , // todo
@@ -33,10 +33,22 @@ private static ErrorBacktrace[] GetBacktraces(StackTrace stackTrace)
33
33
File = sf . GetFileName ( ) ,
34
34
Number = sf . GetFileLineNumber ( ) . ToString ( ) ,
35
35
Method = sf . GetMethod ( ) ? . Name ,
36
- Context = null , // todo
36
+ Context = DetermineContext ( sf . GetFileName ( ) , HoneybadgerClient . Current ? . Options ? . ProjectRoot ) ,
37
37
} ) ;
38
38
}
39
39
40
40
return result . ToArray ( ) ;
41
41
}
42
- }
42
+
43
+ private static string DetermineContext ( string ? fileName , string ? projectRoot )
44
+ {
45
+ if ( ! string . IsNullOrEmpty ( projectRoot ) &&
46
+ ! string . IsNullOrEmpty ( fileName ) &&
47
+ fileName . StartsWith ( projectRoot ) )
48
+ {
49
+ return "app" ;
50
+ }
51
+
52
+ return "all" ;
53
+ }
54
+ }
You can’t perform that action at this time.
0 commit comments