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 0fc7b35
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .run/start jenkins.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
</MavenRunnerParameters>
</option>
</MavenSettings>
<extension name="net.ashald.envfile">
<option name="IS_ENABLED" value="false" />
<option name="IS_SUBST" value="false" />
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
<option name="IS_IGNORE_MISSING_FILES" value="false" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
</ENTRIES>
</extension>
<method v="2" />
</configuration>
</component>
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 0fc7b35

Please sign in to comment.