-
Notifications
You must be signed in to change notification settings - Fork 89
Maintains compatibility with CLI return, broken in PR #266 #309
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
Closed
lrosemberg
wants to merge
12
commits into
roboflow:main
from
lrosemberg:rosemberg/adjust-log-img-cli-error
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
81994ac
Create custom upload exceptions. UploadImageError and AnnotationUploa…
bb22a4d
Handles errors in the correct place
461e976
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] c72dfce
Code quality
33572c2
It is not good to have a global response
3990d64
Correcting the parsing of UploadError
be98a44
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] 875addd
Tests for image upload error, raising a UploadImageError
6582e32
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] ad9738f
Test validating the annotation error
2fc45eb
Keep the pattern on exceptions name
19fca50
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
class UploadImageError(Exception): | ||
""" | ||
Exception raised for errors that occur during the image upload process. | ||
|
||
Attributes: | ||
message (str): A description of the error. | ||
retry_attempts (int): The number of retry attempts made before the error occurred. | ||
""" | ||
|
||
def __init__( | ||
self, | ||
message="An error occurred during the image upload process.", | ||
retry_attempts=0, | ||
): | ||
self.message = message | ||
self.retry_attempts = retry_attempts | ||
super().__init__(self.message) | ||
|
||
|
||
class UploadAnnotationError(Exception): | ||
""" | ||
Exception raised for errors that occur during the annotation upload process. | ||
|
||
Attributes: | ||
message (str): A description of the error. | ||
image_id (Optional[str]): The ID of the image associated with the error. | ||
image_upload_time (Optional[datetime]): The timestamp when the image upload was attempted. | ||
image_retry_attempts (Optional[int]): The number of retry attempts made for the image upload. | ||
""" | ||
|
||
def __init__( | ||
self, | ||
message="An error occurred during the annotation upload process.", | ||
image_id=None, | ||
image_upload_time=None, | ||
image_retry_attempts=None, | ||
): | ||
self.message = message | ||
self.image_id = image_id | ||
self.image_upload_time = image_upload_time | ||
self.image_retry_attempts = image_retry_attempts | ||
super().__init__(self.message) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"it is": [ | ||
{ | ||
"a": 0, | ||
"invalid annotation": true | ||
} | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"info": { | ||
"year": "2020", | ||
"version": "1", | ||
"description": "None", | ||
"contributor": "Linas", | ||
"url": "https://app.roboflow.ai/datasets/hard-hat-sample/1", | ||
"date_created": "2000-01-01T00:00:00+00:00" | ||
}, | ||
"licenses": [ | ||
{ | ||
"id": 1, | ||
"url": "https://creativecommons.org/publicdomain/zero/1.0/", | ||
"name": "Public Domain" | ||
} | ||
], | ||
"categories": [ | ||
{ | ||
"id": 0, | ||
"name": "cat", | ||
"supercategory": "animals" | ||
} | ||
], | ||
"images": [ | ||
{ | ||
"id": 0, | ||
"license": 1, | ||
"file_name": "bla.JPG", | ||
"height": 1024, | ||
"width": 1792, | ||
"date_captured": "2020-07-20T19:39:26+00:00" | ||
} | ||
], | ||
"annotations": [ | ||
{ | ||
"id": 0, | ||
"image_id": 0, | ||
"category_id": 0, | ||
"bbox": [ | ||
45, | ||
2, | ||
85, | ||
85 | ||
], | ||
"area": 7225, | ||
"segmentation": [], | ||
"iscrowd": 0 | ||
}, | ||
{ | ||
"id": 1, | ||
"image_id": 0, | ||
"category_id": 0, | ||
"bbox": [ | ||
324, | ||
29, | ||
72, | ||
81 | ||
], | ||
"area": 5832, | ||
"segmentation": [], | ||
"iscrowd": 0 | ||
} | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the bug reported here:
#266 (comment)