Repository navigation
Conversation
Version._upload_zip() and Workspace._upload_zip() caught every error, printed it and returned, so Version.deploy() and Workspace.deploy_model() looked successful and `roboflow model upload` reported "uploaded" with exit code 0. They now raise RoboflowError with the HTTP status when the upload URL request or the weights upload fails; the 429 branch, whose RuntimeError was swallowed by the same except, raises directly. The CLI already reports exceptions through output_error, so it now exits 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Part 1 of #545.
Version.deploy()andWorkspace.deploy_model()printed upload errors and returned normally, so scripts could not detect a failed upload, androboflow model uploadreported{"status": "uploaded"}with exit code 0.Version._upload_zip()andWorkspace._upload_zip()now raiseRoboflowError(withstatus_code) when the request for the upload URL or the upload of the weights fails, instead of printing and returning. The message keeps the details that were printed before, including the server response.RuntimeErrorwas caught by the surroundingexceptand only printed. I kept its message and appended the server response, because I'm not sure the "already has a trained model" wording still fits now that a version can have several models (Feature: Multiple Models Per Version #497)._upload_modelalready reports exceptions throughoutput_error, soroboflow model uploadnow exits 1 with the error on stderr.withblock, so the handle is closed.Behavior change: code that called
deploy()ordeploy_model()and ignored failures now gets an exception.Part 2 of #545 (
upload_dataset()androboflow image upload <dir>) changes a return value and is left for a separate discussion. This PR touches the same error branches as #548 (API key redaction); whichever is merged first, I'll rebase the other.Test plan
tests/test_model_upload.py: failures of either request in both methods raiseRoboflowErrorwith the HTTP status; a successful upload still prints the status URL; the CLI exits 1 with a JSON error and no "uploaded" status. The five failure tests fail onmainand pass with this change.make check_code_qualitypasses;python -m unittestruns 1217 tests, OK (1 skipped).