Improve message of exception thrown from codegen

Don't lose information about which file caused crash.
This commit is contained in:
Dmitry Savvinov
2018-05-07 17:48:33 +03:00
parent 47bafb8c75
commit 58eb117ae1
@@ -16,12 +16,14 @@
package org.jetbrains.kotlin.codegen;
import org.jetbrains.kotlin.util.ExceptionUtilKt;
public interface CompilationErrorHandler {
CompilationErrorHandler THROW_EXCEPTION = (exception, fileUrl) -> {
if (exception instanceof RuntimeException) {
throw (RuntimeException) exception;
}
throw new IllegalStateException(exception);
throw new IllegalStateException(
ExceptionUtilKt.getExceptionMessage("Backend", "Exception during code generation", exception, fileUrl),
exception
);
};
void reportException(Throwable exception, String fileUrl);