From 9dd910736206d1a1bc84a5bafc0aa0e4f25e3a6c Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Tue, 22 Nov 2011 16:15:57 +0300 Subject: [PATCH] Supporting "kotlin.running.in.server.mode" to throw exception from the analyzer to be logged by the server --- .../jet/lang/resolve/java/AnalyzerFacade.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/AnalyzerFacade.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/AnalyzerFacade.java index 826e741d31a..6ad38396927 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/AnalyzerFacade.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/AnalyzerFacade.java @@ -68,6 +68,18 @@ public class AnalyzerFacade { throw e; } catch (Throwable e) { + // This is needed for the Web Demo server to log the exceptions coming from the analyzer instead of showing them in the editor. + if (System.getProperty("kotlin.running.in.server.mode", "false").equals("true")) { + if (e instanceof RuntimeException) { + RuntimeException runtimeException = (RuntimeException) e; + throw runtimeException; + } + if (e instanceof Error) { + Error error = (Error) e; + throw error; + } + throw new RuntimeException(e); + } e.printStackTrace(); BindingTraceContext bindingTraceContext = new BindingTraceContext(); bindingTraceContext.report(Errors.EXCEPTION_WHILE_ANALYZING.on(file, e));