Skip to content

Commit

Permalink
Fix robot-server docs build script.
Browse files Browse the repository at this point in the history
The actual problem was passing an int where a str was expected.

This was failing in a way that was more annoying than necessary to debug because we were only showing the exception message, not the stack trace. Since this is an internal tool for dev and CI consumption, we have no reason to hide stack traces, so this lets the exception propagate and display in the default Python way.
  • Loading branch information
SyntaxColoring committed Dec 10, 2024
1 parent e065c31 commit fd76bcf
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions robot-server/scripts/spec_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
def write_api_spec(output: TextIOBase) -> None:
spec_dict = get_openapi(
title="Opentrons HTTP API Spec",
version=API_VERSION,
version=str(API_VERSION),
description=(
"This OpenAPI spec describes the HTTP API for Opentrons "
"robots. It may be retrieved from a robot on port 31950 at "
Expand All @@ -34,7 +34,7 @@ def write_api_spec(output: TextIOBase) -> None:
json.dump(spec_dict, output)


def _run_cmdline() -> None:
def _run_cmdline() -> int:
parser = ArgumentParser(
description="Generate a static openapi spec. Note: robot-server must be importable when you run this."
)
Expand All @@ -45,12 +45,8 @@ def _run_cmdline() -> None:
help="Where to write the file (will be json)",
)
args = parser.parse_args()
try:
write_api_spec(args.output)
return 0
except Exception as e:
sys.stderr.write(str(e) + "\n")
return -1
write_api_spec(args.output)
return 0


if __name__ == "__main__":
Expand Down

0 comments on commit fd76bcf

Please sign in to comment.