Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup error logging #79

Merged
merged 1 commit into from
Aug 11, 2022
Merged
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
16 changes: 15 additions & 1 deletion app/commands/close-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ export class CloseCommand extends Command {
logger.info(
`Closing issue ${this.payload.issue.html_url}, reason: ${reason}`
);
await closeIssue(authToken, sourceRepo, this.payload.issue.node_id, reason);
try {
await closeIssue(
authToken,
sourceRepo,
this.payload.issue.node_id,
reason
);
} catch (error) {
logger.error(
`Failed to close issue ${
error.errors ? JSON.stringify(error.errors) : ""
}`,
error
);
}
}
}
23 changes: 16 additions & 7 deletions app/commands/label-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,21 @@ export class LabelCommand extends Command {
logger.info(
`Labeling issue ${this.payload.issue.html_url} with labels ${labels}`
);
await addLabel(
authToken,
this.payload.repository.owner.login,
sourceRepo,
this.payload.issue.node_id,
labels
);
try {
await addLabel(
authToken,
this.payload.repository.owner.login,
sourceRepo,
this.payload.issue.node_id,
labels
);
} catch (error) {
logger.error(
`Failed to add label ${
error.errors ? JSON.stringify(error.errors) : ""
}`,
error
);
}
}
}
23 changes: 16 additions & 7 deletions app/commands/remove-label-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,21 @@ export class RemoveLabelCommand extends Command {
logger.info(
`Removing label(s) from issue ${this.payload.issue.html_url}, labels ${labels}`
);
await removeLabel(
authToken,
this.payload.repository.owner.login,
sourceRepo,
this.payload.issue.node_id,
labels
);
try {
await removeLabel(
authToken,
this.payload.repository.owner.login,
sourceRepo,
this.payload.issue.node_id,
labels
);
} catch (error) {
logger.error(
`Failed to remove label ${
error.errors ? JSON.stringify(error.errors) : ""
}`,
error
);
}
}
}
11 changes: 10 additions & 1 deletion app/commands/reopen-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ export class ReopenCommand extends Command {

logger.info(`Re-opening issue ${this.payload.issue.html_url}`);

await reopenIssue(authToken, sourceRepo, this.payload.issue.node_id);
try {
await reopenIssue(authToken, sourceRepo, this.payload.issue.node_id);
} catch (error) {
logger.error(
`Failed to reopen issue ${
error.errors ? JSON.stringify(error.errors) : ""
}`,
error
);
}
}
}
25 changes: 17 additions & 8 deletions app/commands/reviewer-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,22 @@ export class ReviewerCommand extends Command {
this.payload.repository.owner.login,
reviewerMatches
);
await requestReviewers(
authToken,
this.payload.repository.owner.login,
sourceRepo,
this.payload.issue.node_id,
reviewers.users,
reviewers.teams
);
try {
await requestReviewers(
authToken,
this.payload.repository.owner.login,
sourceRepo,
this.payload.issue.node_id,
reviewers.users,
reviewers.teams
);
} catch (error) {
logger.error(
`Failed to request reviewer ${
error.errors ? JSON.stringify(error.errors) : ""
}`,
error
);
}
}
}
23 changes: 16 additions & 7 deletions app/commands/transfer-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,21 @@ export class TransferCommand extends Command {
logger.info(
`Transferring issue ${this.payload.issue.html_url} to repo ${targetRepo}`
);
await transferIssue(
authToken,
this.payload.repository.owner.login,
sourceRepo,
targetRepo,
this.payload.issue.node_id
);
try {
await transferIssue(
authToken,
this.payload.repository.owner.login,
sourceRepo,
targetRepo,
this.payload.issue.node_id
);
} catch (error) {
logger.error(
`Failed to transfer issue ${
error.errors ? JSON.stringify(error.errors) : ""
}`,
error
);
}
}
}
3 changes: 3 additions & 0 deletions app/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export const defaultConfig = {
reopen: {
enabled: true,
},
close: {
enabled: true,
},
reviewer: {
enabled: true,
},
Expand Down
Loading