Skip to content

Commit 7984f5e

Browse files
committed
exit 1 instead of raise the unhandled exception, causing too much log in
the client
1 parent c6a9177 commit 7984f5e

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

mcp_proxy_for_aws/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def main():
233233
asyncio.run(run_proxy(args))
234234
except Exception:
235235
logger.exception('Error launching MCP proxy for aws')
236-
raise
236+
return 1
237237

238238

239239
if __name__ == '__main__':

tests/unit/test_server.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
"""Tests for the mcp-proxy-for-aws Server."""
1616

17-
import pytest
1817
from fastmcp.client.transports import ClientTransport
1918
from mcp_proxy_for_aws.server import (
2019
add_retry_middleware,
@@ -383,9 +382,8 @@ def test_main_error_handling(self, mock_asyncio_run):
383382
mock_asyncio_run.side_effect = Exception('Test error')
384383

385384
# Act & Assert
386-
with pytest.raises(Exception) as exc_info:
387-
main()
388-
assert 'Test error' in str(exc_info.value)
385+
assert 1 == main()
386+
mock_asyncio_run.assert_called_once()
389387

390388
def test_validate_service_name_service_parsing(self):
391389
"""Test parsing service name from endpoint URL via validate_service_name."""

0 commit comments

Comments
 (0)