@@ -194,6 +194,7 @@ def test_avoided(self, reason):
194194 self .test_skip (reason = reason )
195195 self .test_end ()
196196
197+
197198 @handle_exceptions
198199 def test_interrupt (self ):
199200 if self .current_test is not None :
@@ -406,6 +407,20 @@ def session_end(self):
406407
407408 @handle_exceptions
408409 def error_added (self , result , error ):
410+ self ._add_exception (result = result , exception = error )
411+
412+ @slash .plugins .register_if (hasattr (slash .hooks , 'interruption_added' ))
413+ @handle_exceptions
414+ def interruption_added (self , result , exception ):
415+ self ._add_exception (result = result , exception = exception , is_interruption = True )
416+
417+
418+ def _add_exception (self , result , exception , is_interruption = False ):
419+ has_interruptions = self .client .api .info ().endpoints .add_error .version >= 4
420+ if is_interruption and not has_interruptions :
421+ _logger .debug ('Server does not support recording is_interruption exceptions. Skipping reporting' )
422+ return
423+
409424 if result is slash .session .results .global_result :
410425 error_container = self .session
411426 else :
@@ -415,16 +430,21 @@ def error_added(self, result, error):
415430 _logger .debug ('Could not determine error container to report on for {}' , result )
416431 return
417432
418- kwargs = {'exception_type' : error .exception_type .__name__ if error .exception_type is not None else None ,
419- 'traceback' : distill_slash_traceback (error ), 'exception_attrs' : getattr (error , 'exception_attributes' , NOTHING )}
420- if error .message :
421- message = error .message
422- elif hasattr (error , 'exception_str' ):
423- message = error .exception_str
433+ kwargs = {'exception_type' : exception .exception_type .__name__ if exception .exception_type is not None else None ,
434+ 'traceback' : distill_slash_traceback (exception ), 'exception_attrs' : getattr (exception , 'exception_attributes' , NOTHING )}
435+ if exception .message :
436+ message = exception .message
437+ elif hasattr (exception , 'exception_str' ):
438+ message = exception .exception_str
424439 else :
425- message = str (error .exception )
440+ message = str (exception .exception )
441+
442+
426443 kwargs ['message' ] = message
427444
445+ if has_interruptions :
446+ kwargs ['is_interruption' ] = is_interruption
447+
428448 for compact_variables in [False , True ]:
429449 if compact_variables :
430450 for frame in kwargs ['traceback' ]:
0 commit comments