Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: optimize error handling patterns #4743

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tofarr
Copy link
Collaborator

@tofarr tofarr commented Nov 4, 2024

  • Add consistent error handling decorators for each module type
  • Create base OpenHandsError class for standardized exceptions
  • Improve error messages and logging
  • Add proper type hints
  • Reduce code duplication in error handling

Using OpenHands to DRY up the codebase

  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

This was written by OpenHands in response to the prompt:

The directory OpenHands/openhands contains python packages and modules where much of the error handling uses a syntax that is more verbose than necessary. For example, different exception types are handled using the exact same code repeated. Please find instances of this and replace them with the shorter syntax.

I'm pretty sure it did not hit every file - maybe I need to go through package by package.


Link of any specific issues this addresses


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=ghcr.io/all-hands-ai/runtime:7f658c3-nikolaik   --name openhands-app-7f658c3   ghcr.io/all-hands-ai/runtime:7f658c3

- Add consistent error handling decorators for each module type
- Create base OpenHandsError class for standardized exceptions
- Improve error messages and logging
- Add proper type hints
- Reduce code duplication in error handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant