Better reporting in tests
This commit is contained in:
@@ -7,10 +7,10 @@ public interface CompilationErrorHandler {
|
||||
|
||||
CompilationErrorHandler THROW_EXCEPTION = new CompilationErrorHandler() {
|
||||
@Override
|
||||
public void reportError(String message, String fileUrl) {
|
||||
throw new IllegalStateException(message);
|
||||
public void reportException(Throwable exception, String fileUrl) {
|
||||
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);
|
||||
}
|
||||
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) {
|
||||
generationState.compileCorrectNamespaces(bindingContext, namespaces, new CompilationErrorHandler() {
|
||||
@Override
|
||||
public void reportError(String message, String fileUrl) {
|
||||
compileContext.addMessage(CompilerMessageCategory.WARNING, message, fileUrl, 0, 0);
|
||||
public void reportException(Throwable exception, String fileUrl) {
|
||||
compileContext.addMessage(CompilerMessageCategory.WARNING, exception.getClass().getCanonicalName() + ": " + exception.getMessage(), fileUrl, 0, 0);
|
||||
}
|
||||
});
|
||||
///////////
|
||||
|
||||
Reference in New Issue
Block a user