提交 6badbb32 编写于 作者: K Kohsuke Kawaguchi

Added the error handling screen

This page gets displayed when we throw an unhandled exception.
上级 d3575548
......@@ -42,7 +42,7 @@ THE SOFTWARE.
<properties>
<staplerFork>true</staplerFork>
<stapler.version>1.212</stapler.version>
<stapler.version>1.213</stapler.version>
<spring.version>2.5.6.SEC03</spring.version>
</properties>
......
......@@ -206,7 +206,7 @@ public final class WebAppMain implements ServletContextListener {
context.setAttribute(APP,new HudsonIsLoading());
initThread = new Thread("hudson initialization thread") {
initThread = new Thread("Jenkins initialization thread") {
@Override
public void run() {
boolean success = false;
......
package hudson.init.impl;
import hudson.init.Initializer;
import jenkins.model.Jenkins;
import org.kohsuke.stapler.WebApp;
import org.kohsuke.stapler.compression.CompressionFilter;
import org.kohsuke.stapler.compression.UncaughtExceptionHandler;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author Kohsuke Kawaguchi
*/
public class InstallUncaughtExceptionHandler {
@Initializer
public static void init(final Jenkins j) throws IOException {
CompressionFilter.setUncaughtExceptionHandler(j.servletContext, new UncaughtExceptionHandler() {
@Override
public void reportException(Throwable e, ServletContext context, HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException {
req.setAttribute("javax.servlet.error.exception",e);
WebApp.get(j.servletContext).getSomeStapler()
.invoke(req,rsp, Jenkins.getInstance(), "/oops");
}
});
}
}
......@@ -32,6 +32,7 @@ import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;
import java.util.Vector;
......
......@@ -3630,6 +3630,7 @@ public class Jenkins extends AbstractCIBase implements ModifiableTopLevelItemGro
|| rest.startsWith("/logout")
|| rest.startsWith("/accessDenied")
|| rest.startsWith("/adjuncts/")
|| rest.startsWith("/oops")
|| rest.startsWith("/signup")
|| rest.startsWith("/tcpSlaveAgentListener")
// TODO SlaveComputer.doSlaveAgentJnlp; there should be an annotation to request unprotected access
......
<!--
The MIT License
Copyright (c) 2013- CloudBees, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<!--
This is the page designated by web.xml and UncaughtExceptionHandler to process an exception thrown by us.
-->
<st:statusCode value="500" />
<l:layout title="Jenkins" norefresh="true">
<l:header />
<l:side-panel>
<l:task title="${%Jenkins project}" href="http://jenkins-ci.org/" icon="images/24x24/next.png" />
<l:task title="${%Bug tracker}" href="http://issues.jenkins-ci.org/" icon="images/24x24/gear2.png" />
<l:task title="${%Mailing Lists}" href="http://jenkins-ci.org/content/mailing-lists" icon="images/24x24/search.png"/>
<l:task title="${%Twitter: @jenkinsci}" href="https://twitter.com/jenkinsci" icon="images/24x24/user.png"/>
</l:side-panel>
<l:main-panel>
<h1 style="text-align: center">
<img src="${imagesURL}/rage.png" height="179" width="154"/> <span style="font-size:50px"><st:nbsp/>${%Oops!}</span>
</h1>
<p>
${%problemHappened}
${%checkJIRA}
${%vote}
${%pleaseReport}
${%stackTracePlease}
${%checkML}
</p>
<h2>${%Stack trace}</h2>
<pre style="margin:2em; clear:both">${h.printThrowable(request.getAttribute('javax.servlet.error.exception'))}</pre>
</l:main-panel>
</l:layout>
</j:jelly>
\ No newline at end of file
problemHappened= A problem occurred while processing the request.
checkJIRA= Please check <a href="https://issues.jenkins-ci.org/">our bug tracker</a> to see if a similar problem has already been reported.
vote= If it is already reported, please vote and put a comment on it to let us gauge the impact of the problem.
pleaseReport= If you think this is a new issue, please file a new issue.
stackTracePlease= When you file an issue, make sure to add the entire stack trace, along with the version of Jenkins and relevant plugins.
checkML= <a href="http://jenkins-ci.org/content/mailing-lists">The users list</a> might be also useful in understanding what has happened.
......@@ -207,4 +207,8 @@ THE SOFTWARE.
<mime-type>video/webm</mime-type>
</mime-mapping>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/oops</location>
</error-page>
</web-app>
此差异由.gitattributes 抑制。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册