Get rid of unnecessary exceptions in JS translator

Before this commit, an internal error during JS translation resulted in the
actual exception wrapped in TranslationRuntimeException wrapped in
TranslationInternalException wrapped in RuntimeException being thrown. This
change gets rid of the two latter wrappings.

Also delete unthrown MainFunctionNotFoundException and related unused
constructors in TranslationException
This commit is contained in:
Alexander Udalov
2016-05-23 18:04:49 +03:00
parent 9418311bda
commit 2bd3211ba8
6 changed files with 21 additions and 81 deletions
@@ -55,6 +55,7 @@ import org.jetbrains.kotlin.js.facade.MainCallParameters;
import org.jetbrains.kotlin.js.facade.TranslationResult;
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus;
import org.jetbrains.kotlin.psi.KtFile;
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
import org.jetbrains.kotlin.utils.PathUtil;
import java.io.File;
@@ -169,8 +170,9 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
try {
//noinspection unchecked
translationResult = translator.translate(sourcesFiles, mainCallParameters, jsAnalysisResult);
} catch (Exception e) {
throw new RuntimeException(e);
}
catch (Exception e) {
throw ExceptionUtilsKt.rethrow(e);
}
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();