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; package org.jetbrains.kotlin.codegen;
import org.jetbrains.kotlin.util.ExceptionUtilKt;
public interface CompilationErrorHandler { public interface CompilationErrorHandler {
CompilationErrorHandler THROW_EXCEPTION = (exception, fileUrl) -> { CompilationErrorHandler THROW_EXCEPTION = (exception, fileUrl) -> {
if (exception instanceof RuntimeException) { throw new IllegalStateException(
throw (RuntimeException) exception; ExceptionUtilKt.getExceptionMessage("Backend", "Exception during code generation", exception, fileUrl),
} exception
throw new IllegalStateException(exception); );
}; };
void reportException(Throwable exception, String fileUrl); void reportException(Throwable exception, String fileUrl);