|
20 | 20 | import act.util.ClassInfoByteCodeScanner; |
21 | 21 | import act.util.ClassInfoSourceCodeScanner; |
22 | 22 | import act.util.UploadFileStorageService; |
| 23 | +import act.view.ActServerError; |
23 | 24 | import org.apache.commons.codec.Charsets; |
24 | 25 | import org.osgl._; |
25 | 26 | import org.osgl.exception.UnexpectedException; |
@@ -68,6 +69,8 @@ public enum F { |
68 | 69 | private DependencyInjector<?> dependencyInjector; |
69 | 70 | private IStorageService uploadFileStorageService; |
70 | 71 | private ServiceResourceManager serviceResourceManager; |
| 72 | + // used in dev mode only |
| 73 | + private CompilationException compilationException; |
71 | 74 |
|
72 | 75 | protected App() { |
73 | 76 | } |
@@ -115,6 +118,9 @@ public ProjectLayout layout() { |
115 | 118 |
|
116 | 119 | public void detectChanges() { |
117 | 120 | classLoader.detectChanges(); |
| 121 | + if (null != compilationException) { |
| 122 | + throw new ActServerError(compilationException, this); |
| 123 | + } |
118 | 124 | } |
119 | 125 |
|
120 | 126 | public void restart() { |
@@ -143,7 +149,13 @@ public void refresh() { |
143 | 149 | eventManager().emitEvent(PRE_LOAD_CLASSES); |
144 | 150 | eventBus().emit(PRE_LOAD_CLASSES); |
145 | 151 | initClassLoader(); |
146 | | - scanAppCodes(); |
| 152 | + try { |
| 153 | + scanAppCodes(); |
| 154 | + compilationException = null; |
| 155 | + } catch (CompilationException e) { |
| 156 | + compilationException = e; |
| 157 | + throw new ActServerError(e, this); |
| 158 | + } |
147 | 159 | eventBus().emit(APP_CODE_SCANNED); |
148 | 160 | loadRoutes(); |
149 | 161 | // setting context class loader here might lead to memory leaks |
|
0 commit comments