public Exception smudgedException(Exception rawException) {
        try {
            Throwable cause = rawException.getCause();
            if (cause != null) {
                smudgeException(cause);
            }
            smudgeException(rawException);
        } catch (Exception e) {
            ExceptionUtils.bomb(e);
        }
        return rawException;
    }
@Test
    void shouldSmudgeExceptionMessagesForNestedExceptions() {
        List<CommandArgument> args = List.of(new StringArgument("foo"), new PasswordArgument("bar"));
        List<SecretString> secrets = List.of(new PasswordArgument("quux"));
        ConsoleResult result = new ConsoleResult(0, List.of(" foo ", " bar ", " baz ", " abc "), List.of(" quux ", " bang "), args, secrets);
        Exception innerException = new Exception("baz quux baz");
        Exception topException = new RuntimeException("foo bar abc", innerException);
        Exception exception = result.smudgedException(topException);

        assertThat(exception.getMessage()).isEqualTo("foo ****** abc");
        assertThat(exception).isSameAs(topException);

        assertThat(exception.getCause().getMessage()).isEqualTo("baz ****** baz");
        assertThat(exception.getCause()).isSameAs(innerException);
    }