sweepai / sweep

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

Sweep: Add traceback to error logs in sweepai/utils/graph.py #1874

Open sweep-nightly[bot] opened 1 year ago

sweep-nightly[bot] commented 1 year ago

In the file sweepai/utils/graph.py, the error logs do not use traceback during exceptions. This makes it harder to debug the code when an error occurs.

For example, in the topological_sort method, the error log does not include traceback:

if nx.algorithms.dag.has_cycle(graph): # should never happen because imports dedupe classes and functions
    logger.error(f"The dependency graph has at least one cycle. The file paths are {file_paths}")
    return file_paths

To fix this issue, import the traceback module and include traceback.format_exc() in the error log:

import traceback

if nx.algorithms.dag.has_cycle(graph): # should never happen because imports dedupe classes and functions
    logger.error(f"The dependency graph has at least one cycle. The file paths are {file_paths}\n{traceback.format_exc()}")
    return file_paths

This change should be made wherever an error is logged in the file.

sweep-nightly[bot] commented 1 year ago
Sweeping

0%

Actions (click)


❌ Unable to Complete PR

It looks like an issue has occurred around fetching the files. Perhaps the repo has not been initialized. If this error persists contact team@sweep.dev.

@sweep-nightly[bot], editing this issue description to include more details will automatically make me relaunch.

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.