Skip to content

Commit

Permalink
Nicer error pages
Browse files Browse the repository at this point in the history
  • Loading branch information
timja committed Aug 28, 2023
1 parent 97c46e1 commit 12a1fcd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,18 @@ public void doReload(StaplerRequest request, StaplerResponse response) throws Ex
response.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
}
configure();

try {
configure();
} catch (ConfiguratorException e) {
LOGGER.log(Level.SEVERE, "Failed to reload configuration", e);
request.setAttribute("error", e.getMessage());
if (e.getCause() != null) {
request.setAttribute("cause", e.getCause().getMessage());
}
request.getView(this, "error.jelly").forward(request, response);
return;
}
response.sendRedirect("");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
<l:layout type="one-column" title="${%Error loading configuration}">
<l:main-panel>
<l:app-bar title="${%Error loading configuration}" />

<p>${error}</p>
<j:if test="${cause != null}">
<p>${cause}</p>
</j:if>
</l:main-panel>
</l:layout>
</j:jelly>

0 comments on commit 12a1fcd

Please sign in to comment.