package com.tterrag.k9.util;

import java.io.PrintStream;
import java.io.PrintWriter;

@SuppressWarnings("serial")
public class PassthroughException extends Exception {

    private final Throwable parent;

    public PassthroughException(String message) {
        this(new Exception(message));
    }

    public PassthroughException(Throwable parent) {
        this.parent = parent;
    }
    
    // Hopefully these are enough

    @Override
    public String getMessage() {
        return parent.getMessage();
    }

    @Override
    public String toString() {
        return parent.getClass() == Exception.class ? getMessage() : parent.toString();
    }

    @Override
    public synchronized Throwable getCause() {
        return parent.getCause();
    }

    @Override
    public void printStackTrace(PrintWriter arg0) {
        parent.printStackTrace(arg0);
    }

    @Override
    public void printStackTrace(PrintStream arg0) {
        parent.printStackTrace(arg0);
    }
}

@@ -34,55 +34,36 @@
 ort 
-java.io.PrintStream;%0Aimport java.io.PrintWri
+lombok.experimental.Delega
 te
-r
 ;%0A%0A@
@@ -143,16 +143,243 @@
 ption %7B%0A
+    %0A    private interface Excludes %7B%0A        Throwable fillInStackTrace();%0A        %0A        void addSuppressed(Throwable exception);%0A        %0A        Throwable%5B%5D getSuppressed();%0A    %7D%0A%0A    @Delegate(excludes = Excludes.class)
 %0A    pri
@@ -596,136 +596,8 @@
  %7D%0A 
-   %0A    // Hopefully these are enough%0A%0A    @Override%0A    public String getMessage() %7B%0A        return parent.getMessage();%0A    %7D%0A
 %0A   
@@ -735,331 +735,7 @@
    %7D
-%0A%0A    @Override%0A    public synchronized Throwable getCause() %7B%0A        return parent.getCause();%0A    %7D%0A%0A    @Override%0A    public void printStackTrace(PrintWriter arg0) %7B%0A        parent.printStackTrace(arg0);%0A    %7D%0A%0A    @Override%0A    public void printStackTrace(PrintStream arg0) %7B%0A        parent.printStackTrace(arg0);%0A    %7D
 %0A%7D%0A

Improve PassthroughException to cover (hopefully) all cases