1
0
mirror of https://github.com/prometheus/docs.git synced 2026-02-05 06:45:01 +01:00

fix(abnf-checker): return error on example error

We just printed the error before but not set exit code.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
This commit is contained in:
György Krajcsovits
2025-06-16 13:14:21 +02:00
parent 19b2d91095
commit b0a3961832
2 changed files with 4 additions and 0 deletions

View File

@@ -1184,3 +1184,4 @@ OpenMetrics would like to register two MIME types, `application/openmetrics-text
<!---
# EDITORS NOTE: We would like to thank Sumeer Bhola, but kramdown 2.x does not support `Contributor:` any more so we will add this by hand once consensus has been achieved.
-->

View File

@@ -105,9 +105,12 @@ if __name__ == "__main__":
print(f"Error parsing ABNF: {e}")
sys.exit(1)
print("ABNF parsed successfully.")
exit_code = 0
for ex in examples(filename):
try:
Grammar.get(start_node).parse_all(ex.content)
print(f"Example parsed successfully: {ex.line_number}: {ex.content[:30]}...") # Print first 30 chars
except Exception as e:
print(f"Error parsing example at line {ex.line_number}: {e}\nExample: {ex.content[:30]}...")
exit_code = 2
sys.exit(exit_code)