hkust-nlp / AgentBoard

An Analytical Evaluation Board of Multi-turn LLM Agents
250 stars 26 forks source link

(BUG FIX) Catching `SystemExit`s Independently from Generic `Exception`s #22

Closed zhanwenchen closed 2 months ago

zhanwenchen commented 2 months ago

Currently, all Exceptions are caught and few, if any, are reraised. This prohibits any fatal exceptions from forcing a system exit. Essentially, we want to catch and reraise fatal errors (SystemExits) independently from generic Exceptions like this:

From:

try:
    ...
except Exception as e:
    print(...)
    pass

To:

try:
    ...
except SystemExit as e:
    raise SystemExit('FATAL ERROR ...') from e
except Exception as e:
    print(...)
    pass

See equivalent issue in my fork: https://github.com/zhanwenchen/AgentBoard/issues/1

zhanwenchen commented 2 months ago

NOTE: changed diff base to yours by cherry-picking commits and force-push-with-lease.