Skip to content

Commit 2fc45eb

Browse files
author
Leandro Rosemberg
committed
Keep the pattern on exceptions name
1 parent ad9738f commit 2fc45eb

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

roboflow/core/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(
1717
super().__init__(self.message)
1818

1919

20-
class AnnotationUploadError(Exception):
20+
class UploadAnnotationError(Exception):
2121
"""
2222
Exception raised for errors that occur during the annotation upload process.
2323

roboflow/core/project.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from roboflow.adapters import rfapi
1515
from roboflow.config import API_URL, DEMO_KEYS
16-
from roboflow.core.exceptions import AnnotationUploadError, UploadImageError
16+
from roboflow.core.exceptions import UploadAnnotationError, UploadImageError
1717
from roboflow.core.version import Version
1818
from roboflow.util.general import Retry
1919
from roboflow.util.image_utils import load_labelmap
@@ -539,7 +539,7 @@ def single_upload(
539539
overwrite=annotation_overwrite,
540540
)
541541
except rfapi.UploadError as e:
542-
raise AnnotationUploadError(
542+
raise UploadAnnotationError(
543543
f"Error uploading annotation: {self._parse_upload_error(e)}",
544544
image_id=image_id,
545545
image_upload_time=upload_time,

roboflow/core/workspace.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from roboflow.adapters import rfapi
1212
from roboflow.adapters.rfapi import RoboflowError
1313
from roboflow.config import API_URL, CLIP_FEATURIZE_URL, DEMO_KEYS
14-
from roboflow.core.exceptions import AnnotationUploadError, UploadImageError
14+
from roboflow.core.exceptions import UploadAnnotationError, UploadImageError
1515
from roboflow.core.project import Project
1616
from roboflow.util import folderparser
1717
from roboflow.util.active_learning_utils import check_box_size, clip_encode, count_comparisons
@@ -344,7 +344,7 @@ def _log_img_upload_err(image_path, e):
344344
print(f"[ERR]{retry_attempts} {image_path} ({e.message})")
345345
return
346346

347-
if isinstance(e, AnnotationUploadError):
347+
if isinstance(e, UploadAnnotationError):
348348
upload_time_str = f"[{e.image_upload_time:.1f}s]" if e.image_upload_time else ""
349349
retry_attempts = f" (with {e.image_retry_attempts} retries)" if e.image_retry_attempts > 0 else ""
350350
image_msg = f"[UPLOADED]{retry_attempts} {image_path} ({e.image_id}) {upload_time_str}"
@@ -378,7 +378,7 @@ def _upload_image(imagedesc):
378378
num_retry_uploads=num_retries,
379379
)
380380
_log_img_upload(image_path, uploadres)
381-
except (UploadImageError, AnnotationUploadError) as e:
381+
except (UploadImageError, UploadAnnotationError) as e:
382382
_log_img_upload_err(image_path, e)
383383
except Exception as e:
384384
_log_img_upload_err(image_path, e)

tests/test_project.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from roboflow import API_URL
44
from roboflow.config import DEFAULT_BATCH_NAME
5-
from roboflow.core.exceptions import UploadImageError, AnnotationUploadError
5+
from roboflow.core.exceptions import UploadImageError, UploadAnnotationError
66
from tests import RoboflowTest, PROJECT_NAME, ROBOFLOW_API_KEY
77

88

@@ -105,7 +105,7 @@ def test_upload_raises_upload_annotation_error(self):
105105
status=400,
106106
)
107107

108-
with self.assertRaises(AnnotationUploadError) as error:
108+
with self.assertRaises(UploadAnnotationError) as error:
109109
self.project.upload(
110110
"tests/images/rabbit.JPG",
111111
annotation_path=f"tests/annotations/{image_name}",

0 commit comments

Comments
 (0)