Repository: quarkusio/quarkus
Issue: Dev mode exception returns HTTP 200 reponse

If there is an build error in dev mode, the exception is returned in the body of a http response with HTTP 200 status code. 

I would have expected a HTTP 500 response code if the request failed due to a build error.

The exception below triggered in release 0.9.1, but am not running into a build error with latest master.

e.g. the following request `http://localhost:8080/insurance/rest/authentication/getToken?username=Herb.Daschke_1`

Resulted in an exception in the application:

```
Error Restarting Shamrock
Stack Trace:

java.lang.RuntimeException: org.jboss.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step org.jboss.shamrock.arc.deployment.ArcAnnotationProcessor#build threw an exception: javax.enterprise.inject.UnsatisfiedResolutionException: InjectionPointInfo [requiredType=org.jboss.protean.benchmark.common.broker.IAgentsService, requiredQualifiers=[@RestClient]] on CLASS bean [types=[org.jboss.protean.benchmark.insurance.service.InsuranceAgentsService, java.lang.Object], qualifiers=[@Default, @Any], target=org.jboss.protean.benchmark.insurance.service.InsuranceAgentsService]
	at org.jboss.shamrock.runner.RuntimeRunner.run(RuntimeRunner.java:119)
	at org.jboss.shamrock.dev.DevModeMain.doStart(DevModeMain.java:122)
	at org.jboss.shamrock.dev.DevModeMain.main(DevModeMain.java:83)
Caused by: org.jboss.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step org.jboss.shamrock.arc.deployment.ArcAnnotationProcessor#build threw an exception: javax.enterprise.inject.UnsatisfiedResolutionException: InjectionPointInfo [requiredType=org.jboss.protean.benchmark.common.broker.IAgentsService, requiredQualifiers=[@RestClient]] on CLASS bean [types=[org.jboss.protean.benchmark.insurance.service.InsuranceAgentsService, java.lang.Object], qualifiers=[@Default, @Any], target=org.jboss.protean.benchmark.insurance.service.InsuranceAgentsService]
	at org.jboss.builder.Execution.run(Execution.java:116)
	at org.jboss.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:136)
	at org.jboss.shamrock.deployment.ShamrockAugmentor.run(ShamrockAugmentor.java:101)
	at org.jboss.shamrock.runner.RuntimeRunner.run(RuntimeRunner.java:86)
	... 2 more
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: InjectionPointInfo [requiredType=org.jboss.protean.benchmark.common.broker.IAgentsService, requiredQualifiers=[@RestClient]] on CLASS bean [types=[org.jboss.protean.benchmark.insurance.service.InsuranceAgentsService, java.lang.Object], qualifiers=[@Default, @Any], target=org.jboss.protean.benchmark.insurance.service.InsuranceAgentsService]
	at org.jboss.protean.arc.processor.Beans.resolveInjectionPoint(Beans.java:318)
	at org.jboss.protean.arc.processor.BeanInfo.init(BeanInfo.java:349)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1378)
	at org.jboss.protean.arc.processor.BeanDeployment.init(BeanDeployment.java:281)
	at org.jboss.protean.arc.processor.BeanProcessor.process(BeanProcessor.java:159)
	at org.jboss.shamrock.arc.deployment.ArcAnnotationProcessor.build(ArcAnnotationProcessor.java:237)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.jboss.shamrock.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:383)
	at org.jboss.builder.BuildContext.run(BuildContext.java:402)
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1998)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1525)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1416)
	at java.base/java.lang.Thread.run(Thread.java:844)
	at org.jboss.threads.JBossThread.run(JBossThread.java:479)

```
With the following HTTP response header: 
```
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: text/html; charset=UTF-8
Content-Length: 8197
Date: Thu, 28 Feb 2019 09:16:03 GMT
```

Changed files:
extensions/undertow/deployment/src/main/java/io/quarkus/undertow/devmode/ReplacementDebugPage.java
devtools/maven/src/test/java/io/quarkus/maven/it/MojoTestBase.java
devtools/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java

diff --git a/devtools/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java b/devtools/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java
index 5ece94a960f..c7457500f29 100644
--- a/devtools/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java
+++ b/devtools/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java
@@ -230,7 +230,7 @@ public void testThatApplicationRecoversCompilationIssue() throws MavenInvocation
         await()
                 .pollDelay(1, TimeUnit.SECONDS)
                 .atMost(1, TimeUnit.MINUTES).until(() -> {
-                    String content = getHttpResponse("/app/hello");
+                    String content = getHttpResponse("/app/hello", true);
                     last.set(content);
                     return content.contains(uuid);
                 });
diff --git a/devtools/maven/src/test/java/io/quarkus/maven/it/MojoTestBase.java b/devtools/maven/src/test/java/io/quarkus/maven/it/MojoTestBase.java
index c19e2dbd984..6328c8d60bc 100644
--- a/devtools/maven/src/test/java/io/quarkus/maven/it/MojoTestBase.java
+++ b/devtools/maven/src/test/java/io/quarkus/maven/it/MojoTestBase.java
@@ -7,6 +7,7 @@
 import java.io.IOException;
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.net.URLConnection;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
@@ -159,13 +160,27 @@ static String getHttpResponse() {
     }
 
     static String getHttpResponse(String path) {
+        return getHttpResponse(path, false);
+    }
+
+    static String getHttpResponse(String path, boolean allowError) {
         AtomicReference<String> resp = new AtomicReference<>();
         await()
                 .pollDelay(1, TimeUnit.SECONDS)
                 .atMost(1, TimeUnit.MINUTES).until(() -> {
                     try {
                         URL url = new URL("http://localhost:8080" + ((path.startsWith("/") ? path : "/" + path)));
-                        String content = IOUtils.toString(url, "UTF-8");
+                        String content;
+                        if (!allowError) {
+                            content = IOUtils.toString(url, "UTF-8");
+                        } else {
+                            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+                            if (conn.getResponseCode() >= 400) {
+                                content = IOUtils.toString(conn.getErrorStream(), "UTF-8");
+                            } else {
+                                content = IOUtils.toString(conn.getInputStream(), "UTF-8");
+                            }
+                        }
                         resp.set(content);
                         return true;
                     } catch (Exception e) {
diff --git a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/devmode/ReplacementDebugPage.java b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/devmode/ReplacementDebugPage.java
index 295714e0af5..506f7eaefae 100644
--- a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/devmode/ReplacementDebugPage.java
+++ b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/devmode/ReplacementDebugPage.java
@@ -93,6 +93,7 @@ public class ReplacementDebugPage {
             "</style>";
 
     public static void handleRequest(HttpServerExchange exchange, final Throwable exception) throws IOException {
+        exchange.setStatusCode(500);
         StringBuilder sb = new StringBuilder();
         //todo: make this good
         sb.append("<html><head><title>ERROR</title>");