Added correct exception in Chunks parse output #346

Merged
d.zayakin merged 1 commit from d.zayakin/frostfs-testlib:add-correct-exception-in-chunks-parse-output into master 2025-01-14 06:22:31 +00:00
Member

Signed-off-by: Dmitriy Zayakin d.zayakin@yadro.com

Signed-off-by: Dmitriy Zayakin <d.zayakin@yadro.com>
d.zayakin added 1 commit 2025-01-13 07:54:50 +00:00
[#346] Added correct exception in Chunks parse
All checks were successful
DCO action / DCO (pull_request) Successful in 26s
132ffec3ec
Signed-off-by: Dmitriy Zayakin <d.zayakin@yadro.com>
requested review from qa-committers 2025-01-13 07:54:51 +00:00
abereziny reviewed 2025-01-13 08:01:53 +00:00
@ -162,3 +162,3 @@
parse_result = json.loads(object_nodes)
if parse_result.get("errors"):
raise parse_result["errors"]
raise ValueError("Key error in output, not empty.\n", parse_result["errors"])
Member

Why ValueError?

Raised when an operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more precise exception such as IndexError.

parse_result is not an argument of a function _parse_object_nodes.

also, there is no need to add more text to it.

it's just raise RuntimeError(", ".join(parse_result["errors"]))

Why `ValueError`? ``` Raised when an operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more precise exception such as IndexError. ``` `parse_result` is not an argument of a function `_parse_object_nodes`. also, there is no need to add more text to it. it's just `raise RuntimeError(", ".join(parse_result["errors"]))`
Author
Member

Then why is it a RuntimeError? The mistake here is that we got some kind of value in the key at all, but it shouldn't be there.

Then why is it a RuntimeError? The mistake here is that we got some kind of value in the key at all, but it shouldn't be there.
Member

Then why is it a RuntimeError? The mistake here is that we got some kind of value in the key at all, but it shouldn't be there.

RuntimeError
Raised when an error is detected that doesn’t fall in any of the other categories. The associated value is a string indicating what precisely went wrong.
> Then why is it a RuntimeError? The mistake here is that we got some kind of value in the key at all, but it shouldn't be there. ``` RuntimeError Raised when an error is detected that doesn’t fall in any of the other categories. The associated value is a string indicating what precisely went wrong. ```
d.zayakin marked this conversation as resolved
d.zayakin force-pushed add-correct-exception-in-chunks-parse-output from 132ffec3ec to 974836f1bd 2025-01-13 09:58:43 +00:00 Compare
abereziny approved these changes 2025-01-13 10:00:09 +00:00
Kiriruso approved these changes 2025-01-13 10:19:30 +00:00
i.niyazov approved these changes 2025-01-13 14:03:01 +00:00
d.zayakin merged commit 974836f1bd into master 2025-01-14 06:22:31 +00:00
d.zayakin deleted branch add-correct-exception-in-chunks-parse-output 2025-01-14 06:22:35 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-testlib#346
No description provided.