Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)
Python acoustic-geolocationads-baircraft-trackingairplaneaudio-forensicsdoppler-effectdoppler-shiftgeolocationosintsignal-processing
fix: report local service startup failures without a traceback
Cinna Davis7be18458ac41
diff --git a/src/dopplergeist/cli.py b/src/dopplergeist/cli.pyindex ba435cc..6a68691 100644--- a/src/dopplergeist/cli.py+++ b/src/dopplergeist/cli.py@@ -144,7 +144,11 @@ def main():print(json.dumps(result[-1],indent=2))elif args.command=="serve":from .service import serve- serve(args.jobs,config,port=args.port,max_runtime_s=args.max_runtime,max_upload_bytes=args.max_upload_mb*1024*1024)+ try:+ serve(args.jobs,config,port=args.port,max_runtime_s=args.max_runtime,+ max_upload_bytes=args.max_upload_mb*1024*1024)+ except (OSError, ValueError, OverflowError) as exc:+ parser.error(f"Could not start local service: {exc}")elif args.command=="analyze":from .jobs import JobManagerfrom .contracts import validate_requestdiff --git a/tests/test_cli_input_errors.py b/tests/test_cli_input_errors.pyindex 2245924..f040826 100644--- a/tests/test_cli_input_errors.py+++ b/tests/test_cli_input_errors.py@@ -2,6 +2,7 @@import osfrom pathlib import Path+import socketimport subprocessimport sys@@ -35,3 +36,24 @@ def test_analyze_reports_job_store_initialization_error_without_traceback():assert run.returncode == 2assert "Could not open job store" in run.stderrassert "Traceback" not in run.stderr+++def test_serve_reports_job_store_initialization_error_without_traceback():+ existing_file = Path(__file__)+ run = _run_cli("serve", "--jobs", existing_file, "--port", "0")++ assert run.returncode == 2+ assert "Could not start local service" in run.stderr+ assert "Traceback" not in run.stderr+++def test_serve_reports_occupied_port_without_traceback(tmp_path):+ with socket.socket() as listener:+ listener.bind(("127.0.0.1", 0))+ listener.listen()+ port = listener.getsockname()[1]+ run = _run_cli("serve", "--jobs", tmp_path / "jobs", "--port", str(port))++ assert run.returncode == 2+ assert "Could not start local service" in run.stderr+ assert "Traceback" not in run.stderr