Removed the forced ERROR status when a block fails (except for Request and CF Bypass blocks).

This commit is contained in:
ruri
2019-04-16 19:56:34 +02:00
parent a7ab9922e4
commit 2650c65fc2
3 changed files with 13 additions and 4 deletions
+13 -2
View File
@@ -229,17 +229,28 @@ namespace RuriLib.LS
// If Block -> Process Block
if (BlockParser.IsBlock(CurrentLine))
{
BlockBase block = null;
try
{
var block = BlockParser.Parse(CurrentLine);
block = BlockParser.Parse(CurrentLine);
CurrentBlock = block.Label;
if (!block.Disabled)
block.Process(data);
}
catch (Exception ex)
{
// We log the error message
data.LogBuffer.Add(new LogEntry("ERROR: " + ex.Message, Colors.Tomato));
data.Status = BotStatus.ERROR;
// Stop the execution only if the block is vital for the execution of the script (requests)
// This way we prevent the interruption of the script and an endless retry cycle e.g. if we fail to parse a response given a specific input
if (block != null && (
block.GetType() == typeof(BlockRequest) ||
block.GetType() == typeof(BlockBypassCF)))
{
data.Status = BotStatus.ERROR;
}
throw new BlockProcessingException(ex.Message);
}
}
-1
View File
@@ -689,7 +689,6 @@ namespace RuriLib.Runner
if (Settings.General.BotsDisplayMode == BotsDisplayMode.Everything)
bot.Status = $"<<< ERROR IN BLOCK: {loli.CurrentBlock} >>>";
RaiseMessageArrived(LogLevel.Error, $"[{bot.Id}] ERROR in block {loli.CurrentBlock} | Exception: {ex.Message}", false);
botData.Status = BotStatus.ERROR;
Thread.Sleep(1000);
}
catch (Exception ex)