Skip to content

Commit 71dc5d9

Browse files
Enhance Readability of validation check failures
1 parent 28ffebb commit 71dc5d9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

detection_rules/rule_validators.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from semver import Version
1818

1919
import kql
20+
import click
2021

2122
from . import ecs, endgame
2223
from .config import CUSTOM_RULES_DIR, load_current_package_version, parse_rules_config
@@ -371,7 +372,15 @@ def validate(self, data: "QueryRuleData", meta: RuleMeta, max_attempts: int = 10
371372
# auto add the field and re-validate
372373
self.auto_add_field(validation_checks["stack"], data.index_or_dataview[0])
373374
else:
374-
raise ValueError(f"Error in both stack and integrations checks: {validation_checks}")
375+
stack_error_msg = validation_checks["stack"].error_msg
376+
integration_error_msg = validation_checks["integrations"].error_msg
377+
stack_error_trace = validation_checks["stack"]
378+
integration_trace = validation_checks["integrations"]
379+
click.echo(f"Stack Error Message: {stack_error_msg}")
380+
click.echo(f"Stack Error Trace: {stack_error_trace}")
381+
click.echo(f"Integrations Error Message: {integration_error_msg}")
382+
click.echo(f"Integrations Error Trace: {integration_trace}")
383+
raise ValueError(f"Error in both stack and integrations checks")
375384

376385
else:
377386
break

0 commit comments

Comments
 (0)