Skip to content

Commit a13c954

Browse files
authored
Merge pull request #384 from lqd/issue-errors
Fix fetching issue error handling, improve its errors, validate tracking issues, fix errors in goals
2 parents 21b5af0 + ca3a370 commit a13c954

File tree

6 files changed

+37
-11
lines changed

6 files changed

+37
-11
lines changed

crates/rust-project-goals-cli/src/rfc.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use rust_project_goals::{
1919
labels::GhLabel,
2020
},
2121
goal::{self, GoalDocument, GoalPlan, ParsedOwners},
22-
spanned::{self, Context, Error, Result},
22+
spanned::{self, Context, Error, Result, Spanned},
2323
team::{get_person_data, TeamName},
2424
};
2525

@@ -301,7 +301,15 @@ fn initialize_issues<'doc>(
301301
Some(issue.clone())
302302
} else {
303303
// If not, load its information from the repository by number.
304-
Some(fetch_issue(repository, tracking_issue.number)?)
304+
let existing_issue =
305+
fetch_issue(repository, tracking_issue.number).map_err(|e| {
306+
e.wrap_str(Spanned::here(format!(
307+
"error while fetching declared tracking issue {} for goal {}",
308+
tracking_issue.number,
309+
desired_issue.goal_document.path.display(),
310+
)))
311+
})?;
312+
Some(existing_issue)
305313
}
306314
} else {
307315
// b. If the markdown does not have a declared tracking issue, then we can search through

crates/rust-project-goals/src/gh/issues.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ pub fn fetch_issue(repository: &Repository, issue: u64) -> Result<ExistingGithub
112112
.arg("title,assignees,number,comments,body,state,labels,milestone")
113113
.output()?;
114114

115+
if !output.status.success() {
116+
spanned::bail_here!(
117+
"fetching `{}` issue {} failed: {}",
118+
repository.to_string(),
119+
issue,
120+
String::from_utf8_lossy(&output.stderr)
121+
);
122+
}
123+
115124
let e_i: ExistingGithubIssueJson = serde_json::from_slice(&output.stdout)?;
116125

117126
Ok(ExistingGithubIssue::from(e_i))

crates/rust-project-goals/src/goal.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,15 @@ fn extract_metadata(sections: &[Section]) -> Result<Option<Metadata>> {
451451
spanned::bail!(r[1], "accepted goals cannot have an empty tracking issue");
452452
}
453453

454+
if has_tracking_issue && !r[1].contains("rust-project-goals#") {
455+
spanned::bail!(
456+
r[1],
457+
"tracking issues are issues in the rust-project-goals repository. \
458+
The `{}` issue can go in the `Other tracking issues` row.",
459+
r[1].as_str(),
460+
);
461+
}
462+
454463
// For the others, it's of course optional.
455464
if has_tracking_issue {
456465
Some(r[1].parse()?.content)

src/2025h2/delegation.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Delegation
22

3-
| Metadata | |
4-
| :------------------ | :---------------------- |
5-
| Point of contact | @petrochenkov |
6-
| Status | Not accepted |
7-
| Zulip channel | N/A |
8-
| Tracking issue | [rust-lang/rust#118212] |
9-
| [compiler] champion | @petrochenkov |
3+
| Metadata | |
4+
| :-------------------- | :---------------------- |
5+
| Point of contact | @petrochenkov |
6+
| Status | Not accepted |
7+
| Zulip channel | N/A |
8+
| Other tracking issues | [rust-lang/rust#118212] |
9+
| [compiler] champion | @petrochenkov |
1010

1111
## Summary
1212

src/2025h2/gcc-backend-tests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
|:-----------------|------------------------------------------------|
55
| Point of contact | @GuillaumeGomez |
66
| Status | Proposed |
7-
| Tracking issue | [rust-lang/compiler-team#891] |
7+
| Other tracking issues | [rust-lang/compiler-team#891] |
88
| Zulip channel | [#rustc-codegen-gcc][rustc-codegen-gcc] |
99
| [compiler] champion | @WesleyWiser |
1010
| [infra] champion | @marcoieni |

src/2025h2/rustdoc-doc-cfg.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
|:-----------------|------------------------------------------------|
55
| Point of contact | @GuillaumeGomez |
66
| Status | Proposed |
7-
| Tracking issue | [rust-lang/rust#43781] |
7+
| Other tracking issues | [rust-lang/rust#43781] |
88
| Zulip channel | [#t-rustdoc][t-rustdoc] |
99
| [rustdoc] champion | @GuillaumeGomez |
1010
[t-rustdoc]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc

0 commit comments

Comments
 (0)