1 46 47 package org.codehaus.groovy.control; 48 49 import java.io.PrintWriter ; 50 import java.io.StringWriter ; 51 52 import org.codehaus.groovy.GroovyException; 53 54 55 56 57 64 65 public class CompilationFailedException extends GroovyException 66 { 67 68 71 protected int phase; protected ProcessingUnit unit; 74 75 78 79 public CompilationFailedException( int phase, ProcessingUnit unit ) 80 { 81 super( Phases.getDescription(phase) + " failed" ); 82 this.phase = phase; 83 this.unit = unit; 84 } 85 86 87 90 91 public String toString() 92 { 93 StringWriter data = new StringWriter (); 94 PrintWriter writer = new PrintWriter (data); 95 Janitor janitor = new Janitor(); 96 97 try 98 { 99 unit.write( writer, janitor ); 100 } 101 finally 102 { 103 janitor.cleanup(); 104 } 105 106 return data.toString(); 107 } 108 109 110 111 114 115 public ProcessingUnit getUnit() 116 { 117 return this.unit; 118 } 119 120 } 121 122 123 124 125 | Popular Tags |