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

Changing logic to return payload as json in the case of any exception depending on received bytes #20

Conversation

nsarras
Copy link
Contributor

@nsarras nsarras commented Feb 10, 2023

tested on 4 node vm cluster successfully.

@nsarras nsarras requested a review from a team as a code owner February 10, 2023 03:16
@nsarras nsarras self-assigned this Feb 10, 2023
except socket.error as e:
self.logger.error(f"ClientSocket SocketError: {e}")
raise socket.error(f"ClientSocket SocketError: {e}")
Copy link
Contributor

@grandsuri grandsuri Feb 14, 2023

Choose a reason for hiding this comment

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

if we are removing all the raise exceptions, then why don't we consolidate all these exceptions into a single one and just log the error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we could potentially do that, only downside is that we would lose how long a socket timeout took. If you think it is worth it to simplify the code, then I can go ahead and do that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Except socket.timeout, you can bundle rest of the exceptions to a generic exception unless it has some value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good, thank you

except ValueError as e:
raise ValueError(f"ServerSocket: ValueError - {e}")
Copy link
Contributor

Choose a reason for hiding this comment

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

the top comment applies here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

responded to comment above

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@grandsuri grandsuri merged commit 3a08bde into master Feb 28, 2023
@grandsuri grandsuri deleted the 19-datamover-all-recv_json-socket-exceptions-must-handle-returning-response-payload-upon-exception branch February 28, 2023 22:51
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.

[DataMover] All recv_json socket exceptions must handle returning response payload upon exception
2 participants