show error, don't crash
This commit is contained in:
parent
ff047efd85
commit
305c26c215
1 changed files with 2 additions and 2 deletions
|
@ -105,15 +105,15 @@ public class LabyrinthServer {
|
||||||
exchange.sendResponseHeaders(302, -1);
|
exchange.sendResponseHeaders(302, -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Labyrinth labyrinth = new Labyrinth(width, height, id);
|
|
||||||
final byte[] render;
|
final byte[] render;
|
||||||
try {
|
try {
|
||||||
|
final Labyrinth labyrinth = new Labyrinth(width, height, id);
|
||||||
render = output.render(labyrinth);
|
render = output.render(labyrinth);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
responseHeaders.add("Content-type", "text/plain; charset=UTF-8");
|
responseHeaders.add("Content-type", "text/plain; charset=UTF-8");
|
||||||
exchange.sendResponseHeaders(500, 0);
|
exchange.sendResponseHeaders(500, 0);
|
||||||
final OutputStream responseBody = exchange.getResponseBody();
|
final OutputStream responseBody = exchange.getResponseBody();
|
||||||
responseBody.write(("Error: " + e).getBytes(StandardCharsets.UTF_8));
|
responseBody.write(("Error: " + e.getMessage()).getBytes(StandardCharsets.UTF_8));
|
||||||
responseBody.flush();
|
responseBody.flush();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue