-
Notifications
You must be signed in to change notification settings - Fork 41
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
Update _core.py #110
Merged
Merged
Update _core.py #110
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
added an exception hook for threads forwarding the relevant parameters to minqlx.handle_exception in order to have errors from threads logged in the logfile as well.
Heya,
the use case would be @minqlx.thread, not @minqlx.delay. Right now,
exceptions happening in a thread are not logged, and I had several
occasions where an exception was happening in a thread that went unnoticed
while play testing, only to realize the problem later after many back and
forths, finally taking out the @minqlx.thread, and seeing the problem only
then in the logfiles.
Let me check on those whitespaces.
Best
Markus
…On Sat, Apr 23, 2022 at 8:04 AM Eugene Molotov ***@***.***> wrote:
Hi, Markus!
Using this plugin:
import minqlx
from time import sleep
class test(minqlx.Plugin):
def __init__(self):
self.add_hook("new_game", self.handle_new_game)
def handle_new_game(self):
@minqlx.delay(2)
def f():
raise NotImplementedError("test")
f()
Info about exception appears in logfile without patch in this PR. What is
your use-case?
Also, could you please remove those whitespaces? That are marked as red?
[image: Снимок экрана_2022-04-23_10-50-26]
<https://user-images.githubusercontent.com/15870400/164882255-fcca38af-b90a-40d3-ba80-00f557355ee0.png>
—
Reply to this email directly, view it on GitHub
<#110 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAALXQC5DMICFLZPKTDBJJDVGOHHDANCNFSM5UCW5GMA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
removed unnecessary whitespaces
To reproduce use the following plugin: import minqlx
class exception_thread(minqlx.Plugin):
def __init__(self):
super().__init__()
self.add_command("exception_thread", self.cmd_exception_thread)
def cmd_exception_thread(self, _player: minqlx.Player, _cmd: str, _channel: minqlx.AbstractChannel):
@minqlx.thread
def throws_exception():
self.logger.debug("about to throw exception in thread...")
raise NotImplementedError("Test")
self.logger.debug("about to start exception thread...")
throws_exception()
self.logger.debug("exception thread started...") output before updating _core.py:
output after updating _core.py:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
added an exception hook for threads forwarding the relevant parameters to minqlx.handle_exception in order to have errors from threads logged in the logfile as well.