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

NIOLoopBound has bad error messages #2568

Open
weissi opened this issue Oct 23, 2023 · 4 comments
Open

NIOLoopBound has bad error messages #2568

weissi opened this issue Oct 23, 2023 · 4 comments

Comments

@weissi
Copy link
Member

weissi commented Oct 23, 2023

NIOCore/NIOLoopBound.swift:47: Precondition failed

is all I get :|. I'd have expected some more information. Particularly:

  • what was wrong (wrong thread, maybe even expected and actual thread names)
  • which line was wrong (the bug is not in NIOLoopBound, it's in the code calling it)
@Lukasa
Copy link
Contributor

Lukasa commented Oct 23, 2023

preconditionInEventLoop doesn't currently allow custom error messages, but we could at least pass the file-and-line upwards.

@weissi
Copy link
Member Author

weissi commented Oct 23, 2023

preconditionInEventLoop doesn't currently allow custom error messages, but we could at least pass the file-and-line upwards.

Okay, file/line would help a lot! And I guess we should change the message in preconditionInEventLoop from just Precondition failed to Precondition failed: Not on expected EventLoop thread or something along those lines.

@weissi
Copy link
Member Author

weissi commented Oct 23, 2023

And preconditionInEventLoop could actually pop out expected: ..., actual: ... thread names etc. If completely outside of an eventLoop thread we could say expected: SelectableEventLoop(foo, thread: NIO-ELT-#0-0), actual: <not an EventLoopThread>

@Lukasa
Copy link
Contributor

Lukasa commented Oct 23, 2023

We can do that in the case of MTELG, but it won't work on all ELGs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants