Better reporting in tests

This commit is contained in:
Andrey Breslav
2011-11-12 20:25:38 +04:00
parent 3fcb75ba1d
commit 8d8145c3d2
3 changed files with 6 additions and 6 deletions
@@ -7,10 +7,10 @@ public interface CompilationErrorHandler {
CompilationErrorHandler THROW_EXCEPTION = new CompilationErrorHandler() { CompilationErrorHandler THROW_EXCEPTION = new CompilationErrorHandler() {
@Override @Override
public void reportError(String message, String fileUrl) { public void reportException(Throwable exception, String fileUrl) {
throw new IllegalStateException(message); throw new IllegalStateException(exception);
} }
}; };
void reportError(String message, String fileUrl); void reportException(Throwable exception, String fileUrl);
} }
@@ -112,7 +112,7 @@ public class GenerationState {
generateNamespace(namespace); generateNamespace(namespace);
} }
catch (Throwable e) { catch (Throwable e) {
errorHandler.reportError("Exception: " + e.getClass().getCanonicalName() + ": " + e.getMessage(), namespace.getContainingFile().getVirtualFile().getUrl()); errorHandler.reportException(e, namespace.getContainingFile().getVirtualFile().getUrl());
} }
} }
} }
@@ -104,8 +104,8 @@ public class JetCompiler implements TranslatingCompiler {
if (!errors) { if (!errors) {
generationState.compileCorrectNamespaces(bindingContext, namespaces, new CompilationErrorHandler() { generationState.compileCorrectNamespaces(bindingContext, namespaces, new CompilationErrorHandler() {
@Override @Override
public void reportError(String message, String fileUrl) { public void reportException(Throwable exception, String fileUrl) {
compileContext.addMessage(CompilerMessageCategory.WARNING, message, fileUrl, 0, 0); compileContext.addMessage(CompilerMessageCategory.WARNING, exception.getClass().getCanonicalName() + ": " + exception.getMessage(), fileUrl, 0, 0);
} }
}); });
/////////// ///////////