Skip to content

Inconsistent Error Handling Needs Standardization #10

Open
@sujalsalekar

Description

@sujalsalekar

Title: Inconsistent Error Handling Needs Standardization

Description:

While working with the SDK, I noticed that error handling is inconsistent across different modules, which makes it tricky to handle errors properly in production applications.

Current issues:

  • deal_status.py converts HTTP errors to raw text exceptions:
except requests.HTTPError as error:
    raise Exception(error.response.text)
  • axios.py just re-raises exceptions without context:
except Exception as e:
    raise e
  • upload.py prints errors before raising:
except Exception as e:
    print(e)
    raise e

This makes it really hard to:

  1. Know what kind of errors to expect and catch
  2. Debug issues when they occur
  3. Handle errors consistently in our applications

Suggestion:
We should create a standard error handling approach with:

  1. Custom exception classes for different error types (HTTP, Upload, Auth, etc.)
  2. Consistent error raising patterns across all modules
  3. Proper error context preservation (no raw text conversions)
  4. Remove print statements in favor of proper error messages

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions