Skip to content

Commit

Permalink
Merge pull request #653 from peter-evans/fix-error-handling
Browse files Browse the repository at this point in the history
fix: change or->and to catch all errors
  • Loading branch information
peter-evans authored Dec 9, 2020
2 parents ce699aa + d01e080 commit 8c603db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,11 @@ class GitHubHelper {
};
}
catch (e) {
if (!e.message ||
!e.message.includes(`A pull request already exists for ${headBranch}`)) {
if (e.message &&
e.message.includes(`A pull request already exists for ${headBranch}`)) {
core.info(`A pull request already exists for ${headBranch}`);
}
else {
throw e;
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/github-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ export class GitHubHelper {
}
} catch (e) {
if (
!e.message ||
!e.message.includes(`A pull request already exists for ${headBranch}`)
e.message &&
e.message.includes(`A pull request already exists for ${headBranch}`)
) {
core.info(`A pull request already exists for ${headBranch}`)
} else {
throw e
}
}
Expand Down

0 comments on commit 8c603db

Please sign in to comment.