Пример #1
0
        public void Handle(IConsoleAdapter console, IErrorAdapter error, IMapper mapper)
        {
            try
            {
                var ops = new UserOperations("https://senlabltd.eu.auth0.com/api/v2/", ClientId, Secret, mapper);
                ops.BlockUser(UserId);
                console.WrapLine($"{UserId} blocked.".Cyan());
            }
            catch (AggregateException e)
            {
                error.WrapLine($"Unable to block user {UserId} due to error:".Yellow());

                error.WrapLine(e.Message.Red());

                foreach (var exception in e.InnerExceptions)
                {
                    error.WrapLine(exception.Message.Red());
                }

                Environment.ExitCode = -100;
            }
            catch (Exception e)
            {
                error.WrapLine($"Unable to block user {UserId}s due to error:".Yellow());

                error.WrapLine(e.Message.Red());
                if (e.InnerException != null)
                {
                    error.WrapLine(e.InnerException.Message.Red());
                }

                Environment.ExitCode = -100;
            }
        }