@@ -169,114 +169,77 @@ public void Redact_Redacts_Urls()
169169 }
170170
171171 [ Fact ]
172- public void HasUnhandledException_WithUnhandledException_ReturnsTrue ( )
172+ public void GetExceptionType_NoException_ReturnsNone ( )
173173 {
174- var exception = new Exception ( "test" ) ;
175- exception . SetSentryMechanism ( "test" , handled : false ) ;
176- var evt = new SentryEvent ( exception ) ;
174+ var evt = new SentryEvent ( ) ;
177175
178- Assert . True ( evt . HasUnhandledException ( ) ) ;
176+ Assert . Equal ( SentryEvent . ExceptionType . None , evt . GetExceptionType ( ) ) ;
179177 }
180178
181179 [ Fact ]
182- public void HasUnhandledException_WithHandledException_ReturnsFalse ( )
180+ public void GetExceptionType_HandledException_ReturnsHandled ( )
183181 {
184182 var exception = new Exception ( "test" ) ;
185183 exception . SetSentryMechanism ( "test" , handled : true ) ;
186184 var evt = new SentryEvent ( exception ) ;
187185
188- Assert . False ( evt . HasUnhandledException ( ) ) ;
189- }
190-
191- [ Fact ]
192- public void HasUnhandledException_WithSentryExceptions_Unhandled_ReturnsTrue ( )
193- {
194- var evt = new SentryEvent
195- {
196- SentryExceptions = [ new SentryException { Mechanism = new Mechanism { Handled = false } } ]
197- } ;
198-
199- Assert . True ( evt . HasUnhandledException ( ) ) ;
186+ Assert . Equal ( SentryEvent . ExceptionType . Handled , evt . GetExceptionType ( ) ) ;
200187 }
201188
202189 [ Fact ]
203- public void HasUnhandledException_WithSentryExceptions_Handled_ReturnsFalse ( )
190+ public void GetExceptionType_HandledExceptionViaSentryExceptions_ReturnsHandled ( )
204191 {
205192 var evt = new SentryEvent
206193 {
207194 SentryExceptions = [ new SentryException { Mechanism = new Mechanism { Handled = true } } ]
208195 } ;
209196
210- Assert . False ( evt . HasUnhandledException ( ) ) ;
211- }
212-
213- [ Fact ]
214- public void HasUnhandledNonTerminalException_WithNonTerminalMechanism_ReturnsTrue ( )
215- {
216- var exception = new Exception ( "test" ) ;
217- exception . SetSentryMechanism ( "UnobservedTaskException" , handled : false , terminal : false ) ;
218- var evt = new SentryEvent ( exception ) ;
219-
220- Assert . True ( evt . HasUnhandledNonTerminalException ( ) ) ;
197+ Assert . Equal ( SentryEvent . ExceptionType . Handled , evt . GetExceptionType ( ) ) ;
221198 }
222199
223200 [ Fact ]
224- public void HasUnhandledNonTerminalException_WithHandledException_ReturnsFalse ( )
201+ public void GetExceptionType_UnhandledTerminalException_ReturnsUnhandled ( )
225202 {
226203 var exception = new Exception ( "test" ) ;
227- exception . SetSentryMechanism ( "UnobservedTaskException " , handled : true ) ;
204+ exception . SetSentryMechanism ( "AppDomain.UnhandledException " , handled : false , terminal : true ) ;
228205 var evt = new SentryEvent ( exception ) ;
229206
230- Assert . False ( evt . HasUnhandledNonTerminalException ( ) ) ;
207+ Assert . Equal ( SentryEvent . ExceptionType . Unhandled , evt . GetExceptionType ( ) ) ;
231208 }
232209
233210 [ Fact ]
234- public void HasUnhandledNonTerminalException_WithNullTerminal_ReturnsFalse ( )
211+ public void GetExceptionType_UnhandledTerminalExceptionViaSentryExceptions_ReturnsUnhandled ( )
235212 {
236- // Terminal = null means default behavior (terminal)
213+ // Terminal = null or true means default behavior (terminal)
237214 var evt = new SentryEvent
238215 {
239216 SentryExceptions = [ new SentryException { Mechanism = new Mechanism { Handled = false } } ]
240217 } ;
241218
242- Assert . False ( evt . HasUnhandledNonTerminalException ( ) ) ;
243- }
244-
245- [ Fact ]
246- public void HasTerminalException_WithTerminalUnhandledException_ReturnsTrue ( )
247- {
248- var exception = new Exception ( "test" ) ;
249- exception . SetSentryMechanism ( "AppDomain.UnhandledException" , handled : false , terminal : true ) ;
250- var evt = new SentryEvent ( exception ) ;
251-
252- Assert . True ( evt . HasTerminalException ( ) ) ;
219+ Assert . Equal ( SentryEvent . ExceptionType . Unhandled , evt . GetExceptionType ( ) ) ;
253220 }
254221
255222 [ Fact ]
256- public void HasTerminalException_WithNonTerminalException_ReturnsFalse ( )
223+ public void GetExceptionType_UnhandledNonTerminalException_ReturnsUnhandledNonTerminal ( )
257224 {
258225 var exception = new Exception ( "test" ) ;
259226 exception . SetSentryMechanism ( "UnobservedTaskException" , handled : false , terminal : false ) ;
260227 var evt = new SentryEvent ( exception ) ;
261228
262- Assert . False ( evt . HasTerminalException ( ) ) ;
229+ Assert . Equal ( SentryEvent . ExceptionType . UnhandledNonTerminal , evt . GetExceptionType ( ) ) ;
263230 }
264231
265232 [ Fact ]
266- public void HasTerminalException_WithHandledException_ReturnsFalse ( )
233+ public void GetExceptionType_UnhandledNonTerminalExceptionViaSentryExceptions_ReturnsUnhandledNonTerminal ( )
267234 {
268- var exception = new Exception ( "test" ) ;
269- exception . SetSentryMechanism ( "test" , handled : true ) ;
270- var evt = new SentryEvent ( exception ) ;
235+ var mechanism = new Mechanism { Handled = false } ;
236+ mechanism . Data [ Mechanism . TerminalKey ] = false ;
271237
272- Assert . False ( evt . HasTerminalException ( ) ) ;
273- }
274-
275- [ Fact ]
276- public void HasTerminalException_NoException_ReturnsFalse ( )
277- {
278- var evt = new SentryEvent ( ) ;
238+ var evt = new SentryEvent
239+ {
240+ SentryExceptions = [ new SentryException { Mechanism = mechanism } ]
241+ } ;
279242
280- Assert . False ( evt . HasTerminalException ( ) ) ;
243+ Assert . Equal ( SentryEvent . ExceptionType . UnhandledNonTerminal , evt . GetExceptionType ( ) ) ;
281244 }
282245}
0 commit comments