Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/commands/build/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,15 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
}
);
for (path, reason) in errored_paths_and_reasons {
warn!(" - {} ({})", path.display(), reason);
let reason_str = reason.to_string();
// Provide specific guidance for project not found errors
if reason_str.contains("Project not found") {
warn!(" - {}", path.display());
warn!(" Project not found. Ensure that you configured the correct project and organization.");
warn!(" Use --project and --org flags to specify the correct values.");
} else {
warn!(" - {} ({})", path.display(), reason);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```
$ sentry-cli build upload tests/integration/_fixtures/build/apk.apk --project nonexistentproject
? failed
[..]WARN[..]EXPERIMENTAL: The build subcommand is experimental. The command is subject to breaking changes and may be removed without notice in any release.
WARN [..] Could not detect base branch reference: [..]
WARN [..] Failed to upload 1 file:
WARN [..] - [..]apk.apk
WARN [..] Project not found. Ensure that you configured the correct project and organization.
WARN [..] Use --project and --org flags to specify the correct values.
error: Failed to upload any files

Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
Please attach the full debug log to all bug reports.

```
19 changes: 19 additions & 0 deletions tests/integration/build/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,25 @@ fn command_build_upload_invalid_ipa() {
.run_and_assert(AssertCommand::Failure);
}

#[test]
fn command_build_upload_nonexistent_project() {
TestManager::new()
.mock_endpoint(
MockEndpointBuilder::new("GET", "/api/0/organizations/wat-org/chunk-upload/")
.with_response_file("build/get-chunk-upload.json"),
)
.mock_endpoint(
MockEndpointBuilder::new(
"POST",
"/api/0/projects/wat-org/nonexistentproject/files/preprodartifacts/assemble/",
)
.with_status(404)
.with_response_body(r#"{"detail":"Project not found. Ensure that you configured the correct project and organization."}"#),
)
.register_trycmd_test("build/build-upload-nonexistent-project.trycmd")
.with_default_token();
}

#[test]
fn command_build_upload_apk_all_uploaded() {
TestManager::new()
Expand Down