/**
 * Copyright (C) 2011-2014 Barchart, Inc. <http://www.barchart.com/>
 *
 * All rights reserved. Licensed under the OSI BSD License.
 *
 * http://www.opensource.org/licenses/bsd-license.php
 */
package com.barchart.netty.server.http.error;

import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.barchart.netty.server.http.request.HttpServerRequest;
import com.barchart.netty.server.http.request.HttpServerResponse;

/**
 * Very basic default error handler.
 */
public class DefaultErrorHandler implements ErrorHandler {

	private final static Logger log = LoggerFactory
			.getLogger(DefaultErrorHandler.class);

	@Override
	public void onError(final HttpServerRequest request, final Throwable cause)
			throws IOException {

		final HttpServerResponse response = request.response();

		if (cause != null) {

			log.warn("Uncaught exception thrown in request", cause);
			response.write(cause.getClass()
					+ " was thrown while processing this request.  See logs for more details.");

		} else {

			response.write("Request could not be processed.  Status code: "
					+ response.getStatus());

		}

		response.finish();

	}

}

@@ -454,16 +454,54 @@
 esponse;
+%0Aimport com.google.common.base.Joiner;
 %0A%0A/**%0A *
@@ -887,16 +887,20 @@
 ull) %7B%0A%0A
+%09%09%09%0A
 %09%09%09log.w
@@ -951,16 +951,297 @@
 cause);%0A
+%09%09%09log.error(%22Additional details: %22 +%0A%09%09%09%09%09Joiner.on(%22%5Cn%22).join(%22%22, request.getQueryString(), request.getServerHost(), request.getPathInfo(), request.getMethod())%0A%09%09%09%09%09%0A%09%09%09%09%09);%0A%09%09%09try %7B%0A%09%09%09%09stackTrace();%0A%09%09%09%7D catch (IllegalStateException e) %7B%0A%09%09%09%09log.error(%22Stack trace%22, e);%0A%09%09%09%7D%0A
 %09%09%09respo
@@ -1491,10 +1491,82 @@
 );%0A%0A%09%7D%0A%0A
+%09private void stackTrace() %7B%0A%09%09throw new IllegalStateException(%22%22);%0A%09%7D%0A%0A
 %7D%0A

Add extra logging to DefaultErrorHandler