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:
@@ -1184,3 +1184,4 @@ OpenMetrics would like to register two MIME types, `application/openmetrics-text
|
|||||||
<!---
|
<!---
|
||||||
# EDITOR’S 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.
|
# EDITOR’S 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.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|||||||
@@ -105,9 +105,12 @@ if __name__ == "__main__":
|
|||||||
print(f"Error parsing ABNF: {e}")
|
print(f"Error parsing ABNF: {e}")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
print("ABNF parsed successfully.")
|
print("ABNF parsed successfully.")
|
||||||
|
exit_code = 0
|
||||||
for ex in examples(filename):
|
for ex in examples(filename):
|
||||||
try:
|
try:
|
||||||
Grammar.get(start_node).parse_all(ex.content)
|
Grammar.get(start_node).parse_all(ex.content)
|
||||||
print(f"Example parsed successfully: {ex.line_number}: {ex.content[:30]}...") # Print first 30 chars
|
print(f"Example parsed successfully: {ex.line_number}: {ex.content[:30]}...") # Print first 30 chars
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error parsing example at line {ex.line_number}: {e}\nExample: {ex.content[:30]}...")
|
print(f"Error parsing example at line {ex.line_number}: {e}\nExample: {ex.content[:30]}...")
|
||||||
|
exit_code = 2
|
||||||
|
sys.exit(exit_code)
|
||||||
|
|||||||
Reference in New Issue
Block a user