package battlecode.engine;

// TODO: pass messages along to the client
public class ErrorReporter {

    // reports the error, and tells the contestant to contact the devs
    public static void report(Throwable e) {
        report(e, true);
    }

    public static void report(String message) {
        report(message, true);
    }

    public static void report(String message, boolean ourFault) {
        printHeader();
        System.out.println(message);
        if (ourFault) {
            System.out.print("\n\n");
            printReportString();
        }
        printFooter();
    }

    public static void report(String message, String thingsToTry) {
        printHeader();
        System.out.println(message);
        System.out.print("\n\n");
        printThingsToTry(thingsToTry);
        printFooter();
    }

    public static void report(Throwable e, boolean ourFault) {
        printHeader();
        e.printStackTrace();
        if (ourFault) {
            System.out.print("\n\n");
            printReportString();
        }
        printFooter();
    }

    public static void report(Throwable e, String thingsToTry) {
        printHeader();
        e.printStackTrace();
        System.out.print("\n\n");
        printThingsToTry(thingsToTry);
        printFooter();
    }

    private static void printHeader() {
        System.out.println("~~~~~~~ERROR~~~~~~~");
    }

    private static void printFooter() {
        System.out.println("~~~~~~~~~~~~~~~~~~~");
    }

    private static void printThingsToTry(String thingsToTry) {
        System.out.println("Please try the following:");
        System.out.println(thingsToTry);
        System.out.println("\n\nIf that doesn't work....");
        printReportString();
    }

    private static void printReportString() {
        System.out.println("Please report this to the 6.370 devs, by posting to the forum\n"
                + "under the \"bugs\" thread.  Include a copy of this printout and\n"
                + "a brief description of the bug, including whether it's consistent\n"
                + "or sporadic.  Thanks!");
    }
}

@@ -1851,24 +1851,261 @@
 String() %7B%0D%0A
+%09%09System.out.format(%22java version %5C%22%25s%5C%22%5Cn%22,System.getProperty(%22java.version%22));%0D%0A%09%09System.out.format(%22%25s (build %25s, %25s)%5Cn%5Cn%22,System.getProperty(%22java.vm.name%22),System.getProperty(%22java.vm.version%22),System.getProperty(%22java.vm.info%22));%0D%0A
         Syst

include java version in error reports