Skip to content

Commit 910c018

Browse files
Add GitHub issues link to error messages
1 parent f54c1ad commit 910c018

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

codeflash/main.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22
solved problem, please reach out to us at [email protected]. We're hiring!
33
"""
44

5+
import sys
56
from pathlib import Path
67

78
from codeflash.cli_cmds.cli import parse_args, process_pyproject_config
89
from codeflash.cli_cmds.cmd_init import CODEFLASH_LOGO, ask_run_end_to_end_test
9-
from codeflash.cli_cmds.console import paneled_text
10+
from codeflash.cli_cmds.console import logger, paneled_text
1011
from codeflash.code_utils.config_parser import parse_config_file
1112
from codeflash.optimization import optimizer
1213
from codeflash.telemetry import posthog_cf
1314
from codeflash.telemetry.sentry import init_sentry
1415

1516

16-
def main() -> None:
17-
"""Entry point for the codeflash command-line interface."""
17+
def _main() -> None:
18+
"""Internal entry point for the codeflash command-line interface."""
1819
paneled_text(
1920
CODEFLASH_LOGO, panel_args={"title": "https://codeflash.ai", "expand": False}, text_args={"style": "bold gold3"}
2021
)
@@ -40,5 +41,15 @@ def main() -> None:
4041
optimizer.run_with_args(args)
4142

4243

44+
def main() -> None:
45+
"""Entry point for the codeflash command-line interface with global exception handling."""
46+
try:
47+
_main()
48+
except Exception as e:
49+
logger.error(f"Error: {str(e)}")
50+
logger.error("Raise an issue on Codeflash's Github issues at - https://github.com/codeflash-ai/codeflash/issues")
51+
sys.exit(1)
52+
53+
4354
if __name__ == "__main__":
4455
main()

0 commit comments

Comments
 (0)