@@ -432,10 +432,23 @@ def single_exception(exception, context, **meta):
432432 similarity_encoder = ident_encoder ,
433433 )
434434
435- if exception .mechanism and exception .mechanism .synthetic :
436- type_component .update (contributes = False , hint = "ignored because exception is synthetic" )
435+ ns_error_component = None
436+
437+ if exception .mechanism :
438+ if exception .mechanism .synthetic :
439+ type_component .update (contributes = False , hint = "ignored because exception is synthetic" )
440+ if exception .mechanism .meta and "ns_error" in exception .mechanism .meta :
441+ ns_error_component = GroupingComponent (
442+ id = "ns-error" ,
443+ values = [
444+ exception .mechanism .meta ["ns_error" ].get ("domain" ),
445+ exception .mechanism .meta ["ns_error" ].get ("code" ),
446+ ],
447+ )
437448
438449 values = [stacktrace_component , type_component ]
450+ if ns_error_component is not None :
451+ values .append (ns_error_component )
439452
440453 if context ["with_exception_value_fallback" ]:
441454 value_component = GroupingComponent (id = "value" , similarity_encoder = text_shingle_encoder (5 ))
@@ -453,6 +466,16 @@ def single_exception(exception, context, **meta):
453466 contributes_to_similarity = True ,
454467 hint = "ignored because stacktrace takes precedence" ,
455468 )
469+ if (
470+ ns_error_component is not None
471+ and ns_error_component .contributes
472+ and value_component .contributes
473+ ):
474+ value_component .update (
475+ contributes = False ,
476+ contributes_to_similarity = True ,
477+ hint = "ignored because ns-error info takes precedence" ,
478+ )
456479
457480 values .append (value_component )
458481
0 commit comments