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

Draft: Added InputUriError and IPDistanceCalculationError #182

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Nidhi091999
Copy link

@Nidhi091999 Nidhi091999 commented Jan 20, 2025

Issue: #168

Summary by Sourcery

Add InputUriError and IPDistanceCalculationError exceptions, and add a TesUriError exception.

New Features:

  • Added InputUriError for signaling invalid input URIs.
  • Added IPDistanceCalculationError for when IP distance calculation fails.
  • Added TesUriError for when a TES URI cannot be parsed.

Copy link

sourcery-ai bot commented Jan 20, 2025

Reviewer's Guide by Sourcery

This pull request introduces three new exception classes: InputUriError, IPDistanceCalculationError, and TesUriError. These exceptions are added to the pro_tes/exceptions.py file and are also included in the exceptions dictionary.

Class diagram showing new exception hierarchy

classDiagram
    ValueError <|-- TesUriError
    ValueError <|-- InputUriError
    ValueError <|-- IPDistanceCalculationError
    ValueError <|-- MiddlewareException
    MiddlewareException <|-- InvalidMiddleware

    class TesUriError {
      +str message
      +str code
    }
    note for TesUriError "New: Raised when TES URI cannot be parsed"

    class InputUriError {
      +str message
      +str code
    }
    note for InputUriError "New: Raised when input URI cannot be parsed"

    class IPDistanceCalculationError {
      +str message
    }
    note for IPDistanceCalculationError "New: Raised when IP distance cannot be calculated"

    class MiddlewareException {
      +str message
      +str code
    }

    class InvalidMiddleware {
      +str message
      +str code
    }
Loading

File-Level Changes

Change Details Files
Added InputUriError exception class.
  • Added InputUriError class inheriting from ValueError.
  • Added InputUriError to the exceptions dictionary with a message and code.
pro_tes/exceptions.py
Added IPDistanceCalculationError exception class.
  • Added IPDistanceCalculationError class inheriting from ValueError.
  • Added IPDistanceCalculationError to the exceptions dictionary with a message.
pro_tes/exceptions.py
Added TesUriError exception class.
  • Added TesUriError class inheriting from ValueError.
  • Added TesUriError to the exceptions dictionary with a message.
pro_tes/exceptions.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Nidhi091999 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please fill out the PR description with details about the motivation for these new exceptions and reference any related issues.
  • The exceptions dictionary entries should maintain consistency - TesUriError and IPDistanceCalculationError are missing HTTP status codes while other entries have them.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -94,4 +102,14 @@ class InvalidMiddleware(MiddlewareException):
"message": "Middleware is invalid.",
"code": "500",
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Missing error code for TesUriError and IPDistanceCalculationError exceptions

Other exceptions in the dictionary include both 'message' and 'code' fields. Consider adding appropriate error codes to maintain consistency 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