1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

improve webfront command error feedback

This commit is contained in:
RaidMax
2022-10-25 14:52:12 -05:00
parent a2ccefd89d
commit 5112d88ce2
4 changed files with 18 additions and 6 deletions

View File

@ -26,12 +26,20 @@ public class RemoteCommandService : IRemoteCommandService
public async Task<IEnumerable<CommandResponseInfo>> Execute(int originId, int? targetId, string command,
IEnumerable<string> arguments, Server server)
{
var (success, result) = await ExecuteWithResult(originId, targetId, command, arguments, server);
return result;
}
public async Task<(bool, IEnumerable<CommandResponseInfo>)> ExecuteWithResult(int originId, int? targetId, string command,
IEnumerable<string> arguments, Server server)
{
if (originId < 1)
{
_logger.LogWarning("Not executing command {Command} for {Originid} because origin id is invalid", command,
originId);
return Enumerable.Empty<CommandResponseInfo>();
return (false, Enumerable.Empty<CommandResponseInfo>());
}
var client = await _clientService.Get(originId);
@ -94,6 +102,6 @@ public class RemoteCommandService : IRemoteCommandService
};
}
return response;
return (!remoteEvent.Failed, response);
}
}