Added basic cache error handling
This commit is contained in:
parent
d7b1486615
commit
c5229a22b2
1 changed files with 11 additions and 1 deletions
|
@ -99,7 +99,17 @@ namespace Noikoio.RegexBot.Module.ModTools.Commands
|
||||||
Match m = UserMention.Match(targetstr);
|
Match m = UserMention.Match(targetstr);
|
||||||
if (m.Success) targetstr = m.Groups["snowflake"].Value;
|
if (m.Success) targetstr = m.Groups["snowflake"].Value;
|
||||||
|
|
||||||
var qres = (await EntityCache.EntityCache.QueryAsync(g.Id, targetstr)).FirstOrDefault();
|
EntityCache.CacheUser qres;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
qres = (await EntityCache.EntityCache.QueryAsync(g.Id, targetstr)).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Npgsql.NpgsqlException ex)
|
||||||
|
{
|
||||||
|
await Log("A database error occurred during user lookup: " + ex.Message);
|
||||||
|
await msg.Channel.SendMessageAsync(FailPrefix + FailDefault);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (qres == null)
|
if (qres == null)
|
||||||
{
|
{
|
||||||
await SendUsageMessage(msg, TargetNotFound);
|
await SendUsageMessage(msg, TargetNotFound);
|
||||||
|
|
Loading…
Reference in a new issue