Skip to content
2 changes: 1 addition & 1 deletion PyBugReporter/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.10'
__version__ = '1.0.10b0.dev2'
22 changes: 19 additions & 3 deletions PyBugReporter/src/BugReporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,17 @@ async def _getRepoId_async(self, handler: BugHandler) -> str:
def manualBugReport(cls, repoName: str, errorTitle: str, errorMessage: str) -> None:
"""Manually sends a bug report to the Github repository.

Args:
repoName (str): the name of the repo to report to
errorTitle (str): the title of the error
errorMessage (str): the error message
"""
asyncio.run(cls.manualBugReportAsync(repoName,errorTitle,errorMessage))

@classmethod
async def manualBugReportAsync(cls, repoName: str, errorTitle: str, errorMessage: str) -> None:
"""Manually sends a bug report to the Github repository.

Args:
repoName (str): the name of the repo to report to
errorTitle (str): the title of the error
Expand All @@ -381,7 +392,7 @@ def manualBugReport(cls, repoName: str, errorTitle: str, errorMessage: str) -> N
headers = {"Authorization": f"Bearer {handler.githubKey}"}

# query variables
repoId = cls._getRepoId(cls, handler)
repoId = await cls._getRepoId_async(cls, handler)
bugLabel = "LA_kwDOJ3JPj88AAAABU1q15w"
autoLabel = "LA_kwDOJ3JPj88AAAABU1q2DA"

Expand Down Expand Up @@ -414,10 +425,15 @@ def manualBugReport(cls, repoName: str, errorTitle: str, errorMessage: str) -> N
}
}

issueExists = cls._checkIfIssueExists(cls, handler, errorTitle)
issueExists = await cls._checkIfIssueExists_async(cls, handler, errorTitle)

# Send to Discord if applicable
if cls.handlers[repoName].useDiscord:
discordBot = DiscordBot(cls.handlers[repoName].botToken, cls.handlers[repoName].channelId)
await discordBot.send_message(f"## {repoName}: {errorTitle}\n{errorMessage}", issueExists)

if (issueExists == False):
result = asyncio.run(client.execute_async(query=createIssue, variables=variables, headers=headers))
result = await client.execute_async(query=createIssue, variables=variables, headers=headers)
print('\nThis error has been reported to the Tree Growth team.\n')
else:
print('\nOur team is already aware of this issue.\n')
82 changes: 44 additions & 38 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

BugReporter.setVars(token, 'PyBugReporter', 'byuawsfhtl', False, True, discordToken, channelId)

BugReporter.manualBugReport("PyBugReporter",
"Testing manual bug report",
"This is a test of the manual bug report functionality")

@BugReporter('PyBugReporter', extraInfo=True, env='test')
def test(item, item2=None):
# raise Exception("""
Expand Down Expand Up @@ -53,43 +57,45 @@ def test(item, item2=None):
# really really really really really really really really long test exception
# """)

def this():
def exception():
def has():
def an():
def insane():
def traceback():
def length():
def that():
def just():
def keeps():
def going():
def on():
def yep():
def still():
def more():
def never():
def do():
def this():
raise Exception("This is a test exception")
this()
do()
never()
more()
still()
yep()
on()
going()
keeps()
just()
that()
length()
traceback()
insane()
an()
has()
exception()
this()
# def this():
# def exception():
# def has():
# def an():
# def insane():
# def traceback():
# def length():
# def that():
# def just():
# def keeps():
# def going():
# def on():
# def yep():
# def still():
# def more():
# def never():
# def do():
# def this():
# raise Exception("This is a test exception")
# this()
# do()
# never()
# more()
# still()
# yep()
# on()
# going()
# keeps()
# just()
# that()
# length()
# traceback()
# insane()
# an()
# has()
# exception()
# this()

raise Exception("This is a test exception")


test(None, item2='item2')
# test(None, item2='item2')