Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""Exceptions collection related to interactions with GitHub."""
import attr
from gidgethub import GitHubException
# pylint: disable=relative-beyond-top-level
from ..models.action_outcomes import ActionOutcome
class GitHubError(GitHubException):
"""Generic GitHub-related error."""
@attr.dataclass
class GitHubActionError(GitHubError):
"""Generic GitHub-related error."""
_outcome: ActionOutcome
def terminate_action(self):
"""Terminate current process using corresponding return code."""
self._outcome.raise_it()
async def iter_pr_commits(self, number: int):
"""Create iterator over commits in a PR"""
var_data = copy(self.var_default)
var_data['number'] = str(number)
try:
async for item in self.api.getiter(self.PULL_COMMITS, var_data):
yield item
except gidgethub.GitHubException:
return