Bug fixes in !wiki and errorHandler

This commit is contained in:
runebaas 2018-04-28 02:46:30 +02:00
parent 4548c6083a
commit f5fd9ba017
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
4 changed files with 9 additions and 5 deletions

View file

@ -47,7 +47,9 @@ namespace Geekbot.net.Lib
{
if (_errorsInChat)
{
Context.Channel.SendMessageAsync($"{e.Message}\r\n```\r\n{e.InnerException}\r\n```");
var resStackTrace = string.IsNullOrEmpty(e.InnerException?.ToString()) ? e.StackTrace : e.InnerException.ToString();
var maxLen = Math.Min(resStackTrace.Length, 1850);
Context.Channel.SendMessageAsync($"{e.Message}\r\n```\r\n{resStackTrace?.Substring(0, maxLen)}\r\n```");
}
else
{
@ -72,6 +74,7 @@ namespace Geekbot.net.Lib
}
catch (Exception ex)
{
Context.Channel.SendMessageAsync("Something went really really wrong here");
_logger.Error("Geekbot", "Errorception", ex);
}
}