From 6ed2f3906663115e2a5a1ab422faab0e11d6821b Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 9 May 2026 12:17:40 +0000 Subject: [PATCH] devicesapi: forward status_code through DeviceApiError to parent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same bug pattern fixed in commit 7c7037e for ImageUploadError / AnnotationSaveError, missed in DeviceApiError because it lives in devicesapi.py rather than rfapi.py. After this PR moved `self.status_code = status_code` into the parent RoboflowError.__init__, any subclass that set the attribute itself and then called super().__init__(message) without forwarding status_code got `None` written back over the value — every DeviceApiError raised by _raise_for_status had status_code=None instead of the real HTTP code, breaking the 7 status_code assertions in tests/test_device.py. Forward status_code through to super(), matching the rfapi.py fix. --- roboflow/adapters/devicesapi.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roboflow/adapters/devicesapi.py b/roboflow/adapters/devicesapi.py index 7a655133..92534542 100644 --- a/roboflow/adapters/devicesapi.py +++ b/roboflow/adapters/devicesapi.py @@ -38,8 +38,7 @@ class DeviceApiError(RoboflowError): """Raised when a device API call returns a non-success status.""" def __init__(self, message: str, status_code: Optional[int] = None) -> None: - self.status_code = status_code - super().__init__(message) + super().__init__(message, status_code=status_code) class DeviceNotFoundError(DeviceApiError):