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
-1
View File
@@ -426,7 +426,6 @@ namespace OpenBullet
} }
catch (Exception ex) { catch (Exception ex) {
Globals.LogError(Components.Stacker, $"Processing of line {BlockBase.TruncatePretty(vm.LS.CurrentLine, 20)} failed, exception: {ex.Message}"); Globals.LogError(Components.Stacker, $"Processing of line {BlockBase.TruncatePretty(vm.LS.CurrentLine, 20)} failed, exception: {ex.Message}");
vm.BotData.Status = BotStatus.ERROR;
} }
PrintBotData(); PrintBotData();
+13 -2
View File
@@ -229,17 +229,28 @@ namespace RuriLib.LS
// If Block -> Process Block // If Block -> Process Block
if (BlockParser.IsBlock(CurrentLine)) if (BlockParser.IsBlock(CurrentLine))
{ {
BlockBase block = null;
try try
{ {
var block = BlockParser.Parse(CurrentLine); block = BlockParser.Parse(CurrentLine);
CurrentBlock = block.Label; CurrentBlock = block.Label;
if (!block.Disabled) if (!block.Disabled)
block.Process(data); block.Process(data);
} }
catch (Exception ex) catch (Exception ex)
{ {
// We log the error message
data.LogBuffer.Add(new LogEntry("ERROR: " + ex.Message, Colors.Tomato)); 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); throw new BlockProcessingException(ex.Message);
} }
} }
-1
View File
@@ -689,7 +689,6 @@ namespace RuriLib.Runner
if (Settings.General.BotsDisplayMode == BotsDisplayMode.Everything) if (Settings.General.BotsDisplayMode == BotsDisplayMode.Everything)
bot.Status = $"<<< ERROR IN BLOCK: {loli.CurrentBlock} >>>"; bot.Status = $"<<< ERROR IN BLOCK: {loli.CurrentBlock} >>>";
RaiseMessageArrived(LogLevel.Error, $"[{bot.Id}] ERROR in block {loli.CurrentBlock} | Exception: {ex.Message}", false); RaiseMessageArrived(LogLevel.Error, $"[{bot.Id}] ERROR in block {loli.CurrentBlock} | Exception: {ex.Message}", false);
botData.Status = BotStatus.ERROR;
Thread.Sleep(1000); Thread.Sleep(1000);
} }
catch (Exception ex) catch (Exception ex)