Remora.Discord
Remora.Discord copied to clipboard
Improve GatewayError printing
I just extended the GatewayError handling in the DiscordGatewayClient to also print the inner error to console.
This shows for example the cause why the gateway endpoint was not able to get.
This is good, but I think a better option is to improve the pretty-printing of all errors in Remora.Results, then just use that.
I see your point. I suppose printing the error chain associated with a result would be to first to tackle.
My idea for pretty printing would be as follows:
Result? result = ...;
int indentLevel = 0
while (result is not null && !result.IsSuccess) {
foreach (var property in result.Error.Properties) { // Properties = Public Properties of Error Type
PrintIdented(indentLevel, $"{property.Name} = {property.Value}");
}
result = result.Inner;
indentLevel++;
}
I agree, it would be nice if Remora.Results could pretty print all errors for us to our logs (but have us have to pass in the logger to use).
Yep, this sounds good. Can you open an issue on Remora.Results and reference it here?
Going to close this and refocus the idea onto Remora.Results.