Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): explain PR watcher read failures #19254

Closedandrewfree(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/19254/headopened View on GitHub

Showing 2 changed files with 33 additions and 3 deletions (loading 1).

x
0 of 2 viewed, 2 left
33 additions and 3 deletionsapps/server/src/orchestration-v2/PullRequestWatchReactor.tsModified
View file
@@ -67,6 +67,33 @@
error.cause.reason === "rate-limited",
});
​
+/** Only typed categories reach the wake message; host errors can contain credentials or output. */
+const readFailureSummary = (cause: Cause.Cause<PullRequestService.PullRequestError>) =>
+ Option.match(Cause.findErrorOption(cause), {
+ onNone: () => "An unexpected error occurred.",
+ onSome: (error) => {
+ if (error._tag === "PullRequestUnavailableError") return error.message;
+ if (error.reason === "not-found") {
+ return "The pull request was not found or is not accessible.";
+ }
+ if (isProviderError(error.cause)) {
+ switch (error.cause.reason) {
+ case "missing-tool":
+ return "The host tool or credentials are not configured.";
+ case "unauthenticated":
+ return "The host rejected its credentials.";
+ case "not-found":
+ return "The pull request was not found or is not accessible.";
+ case "rate-limited":
+ return "The host rate limit was reached.";
+ case "failed":
+ return "The host request failed.";
+ }
+ }
+ return "The pull request operation failed.";
+ },
+ });