Proper exception rethrowing in UtilityAI

This commit is contained in:
Vera Aguilera Puerto
2021-05-27 12:34:52 +02:00
parent 0c68f2973e
commit c1b247ff22

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Runtime.ExceptionServices;
using System.Threading;
using Content.Server.AI.Operators;
using Content.Server.AI.Utility.Actions;
@@ -137,6 +138,9 @@ namespace Content.Server.AI.Utility.AiLogic
break;
default:
Logger.FatalS("ai", _actionRequest.Exception.ToString());
ExceptionDispatchInfo.Capture(_actionRequest.Exception).Throw();
// The code never actually reaches here, because the above throws.
// This is to tell the compiler that the flow never leaves here.
throw _actionRequest.Exception;
}
var action = _actionRequest.Result;