sweepai / sweep

Sweep: open-source AI-powered Software Developer for small features and bug fixes.
https://sweep.dev
Other
7.32k stars 419 forks source link

Sweep: Add traceback to error logs in sweepai/utils/diff.py #1772

Open sweep-nightly[bot] opened 10 months ago

sweep-nightly[bot] commented 10 months ago

In the file sweepai/utils/diff.py, the logger is used for logging, but traceback is not used during exceptions. This is against the user's rules which require the use of traceback during exceptions for better error tracking.

For instance, in the function generate_new_file_from_patch, an exception is raised without using traceback. Here is the code snippet:

if max_similarity == 0:
    raise Exception("No identical lines")

To fix this issue, traceback should be used when raising exceptions. Here is an example of how to do it:

import traceback

try:
    # code that may raise an exception
except Exception as e:
    logger.error(traceback.format_exc())

Please make the necessary changes to conform to the rules.

sweep-nightly[bot] commented 10 months ago
Sweeping

25%

Actions (click)


❌ Unable to Complete PR

I'm sorry, but it looks like an error has occurred. Try changing the issue description to re-trigger Sweep. If this error persists contact team@sweep.dev.

For bonus GPT-4 tickets, please report this bug on Discord.


🎉 Latest improvements to Sweep:


💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.