You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This method panics if a channel login of invalid format is passed to it. (As determined
by [crate::validate::validate_login].) If you are dealing with unsanitized
user input, you must manually call this validate function before calling this function,
in order to avoid panicking your program.
Would you be open to changing the signature of these functions to return something like a Result<(), ValidationError> instead of panicking? A few reasons for my request:
I don't want libraries that I use to call panic!() for trivial reasons.
panic!() should only be used when something goes really wrong. Attempting to join an ill-formed channel should not be that.
There is a function allowing you to verify whether the channel is apparently OK or not. So why panic at all?
I'm happy to implement the change and provide a PR if you're OK with it.
Thanks
The text was updated successfully, but these errors were encountered:
teotwaki
changed the title
Unnecessary duplicate checks
Aggressive use of panic!()Mar 5, 2022
I had a bit of a problem with returning Result<(), ValidationError> from those methods because it makes the API interface a bit clunky (requiring String is already a bit clunky...). I strive to make the API of the library sensible, simple to use and self-explanatory.
But you make a good point, I think I will reconsider this. I'll take the time today to change this.
Hi,
Thanks a lot for this library. Very nice!
From the documentation for
TwitchIRCClient::join
:Would you be open to changing the signature of these functions to return something like a
Result<(), ValidationError>
instead of panicking? A few reasons for my request:panic!()
for trivial reasons.panic!()
should only be used when something goes really wrong. Attempting to join an ill-formed channel should not be that.I'm happy to implement the change and provide a PR if you're OK with it.
Thanks
The text was updated successfully, but these errors were encountered: