Skip to content

Commit e2d2443

Browse files
committed
Show error messages from ServiceMayNotContinueException
Change-Id: Ifd6669810c201faa04dec6688460c4945e196290
1 parent 84286b7 commit e2d2443

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

java/com/google/gitiles/HostIndexServlet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
2121
import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE;
2222
import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED;
23+
import static org.eclipse.jgit.http.server.GitSmartHttpTools.sendError;
2324

2425
import com.google.common.base.Strings;
2526
import com.google.common.collect.ImmutableMap;
@@ -75,8 +76,7 @@ private Map<String, RepositoryDescription> list(
7576
res.sendError(SC_UNAUTHORIZED);
7677
return null;
7778
} catch (ServiceMayNotContinueException e) {
78-
// TODO(dborowitz): Show the error message to the user.
79-
res.sendError(e.getStatusCode());
79+
sendError(req, res, e.getStatusCode(), e.getMessage());
8080
return null;
8181
} catch (IOException err) {
8282
String name = urls.getHostName(req);

java/com/google/gitiles/ViewFilter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import static com.google.common.base.Preconditions.checkNotNull;
1919
import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
2020
import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE;
21+
import static org.eclipse.jgit.http.server.GitSmartHttpTools.sendError;
2122
import static org.eclipse.jgit.http.server.ServletUtils.ATTRIBUTE_REPOSITORY;
2223

2324
import com.google.common.base.Strings;
@@ -105,7 +106,7 @@ public void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChai
105106
try {
106107
view = parse(req);
107108
} catch (ServiceMayNotContinueException e) {
108-
res.setStatus(e.getStatusCode());
109+
sendError(req, res, e.getStatusCode(), e.getMessage());
109110
return;
110111
} catch (IOException err) {
111112
String name = urls.getHostName(req);

0 commit comments

Comments
 (0)