示例#1
0
        private async Task <int> HandleInternal(ParseResult parseResult)
        {
            CurrentParseResult = parseResult;

            var endpoint = parseResult.RootCommandResult
                           .OptionResult("--endpoint")?
                           .GetValueOrDefault <MigoEndpoint>();

            if (!endpoint.HasValue)
            {
                Log.Error("Invalid endpoint");
                return(ResultCode.Failure);
            }

            try
            {
                await Handle(endpoint.Value).ConfigureAwait(false);

                Log.Information("OK.");
            }
            catch (SocketException socketException)
            {
                Log.Error($"{(int)socketException.SocketErrorCode} {socketException.Message}");
                return(ResultCode.Failure);
            }

            return(ResultCode.Success);
        }