FragLand/minestat

Expose ConnStatus

Closed this issue · 4 comments

As far as I can tell there is currently no way to know why getting a server's status failed. I can see there is a ConnStatus enum being used internally (Success, ConnFail, Timeout, Unknown), but this is not publicly accessible. I think it would be nice to be able to access this information.

I am referring to C#, but I assume it is not publicly accessible in other languages as well.

Hi @Jordan9232, a warm welcome to MineStat!

I think that exposing the ConnStatus should be possible without a problem.
What I am currently unsure of is whether that information is actually usable/useful? I haven't looked at the code for a few months, but in many cases we can't really determine a specific error cause. If the granularity Unknown (something failed in the protocol decoding), Timeout (connection timed out) and ConnFail (IP unreachable, port closed, other network errors) is enough, that should suffice and be possible.

Best regards,
MindSolve

To explain why it's usable/useful to me, in my case if ServerUp is false I want to display an error message to my users, but I want to use a different error message depending on ConnFail, Timeout, or Unknown. Those 3 different reasons are enough for me.

Progress

Variant Connection status exposed?
C# ✔️ (Merged PR #122)
Go
Java ✔️ (Merged PR #121)
JavaScript
PHP ✔️ (Merged PR #125)
Perl
PowerShell ✔️ (Merged PR #122)
Python ✔️ (Merged PR #135)
Ruby ✔️ (Merged PR #121)

As with issue #120, I'll resolve this issue now that PR #122 has been merged. The Go, JavaScript, and Perl subprojects will also contain this property once they gain feature parity with the other language variants.