Post download failure event.

@param request download request
@param statusCode status code
@param errMsg error message
180298
void postFailure(final DownloadRequest request, final int statusCode, final String errMsg) {
    downloadPoster.execute(new Runnable() {
      @Override public void run() {
        request.downloadCallback().onFailure(request.downloadId(), statusCode, errMsg);
      }
    });
  }
1195688
def _send_err(self, msg, errName, errMsg):
        
        r = message.ErrorMessage(
            errName,
            msg.serial,
            body=[errMsg],
            signature='s',
            destination=msg.sender,
        )

        self.conn.sendMessage(r)
277736
public void requestFailed(JSONObject info) {
        logger.error("BaseRequest failed with info: " + (info == null ? "info is null" : info.toString()));
        listener.onFailure(null, null, info);
    }
779685
public void attempt(Request request) {
    this.attempt(request, new APICallback() {
      @Override
      public void error(Exception ex) {
      }

      public void response(Response r) {
      }
    });
  }
588807
function() {
            var err = null, status = parseInt(res.statusCode, 10);
            if (status > 399) { // Unsuccessful HTTP status? Then pass an error to the callback
                var match = data.match(/^\{"message": "(.+)"\}/i);
                err = new error.DiscogsError(status, ((match && match[1]) ? match[1] : null));
            }
            callback(err, data, rateLimit);
        }
1146497
protected void processServerErrorCallback(HttpServletRequest request, HttpServletResponse response, Throwable cause) {
        final RequestServerErrorHandler serverErrorHandler = serverErrorHandlerLocal.get();
        if (serverErrorHandler == null) {
            return;
        }
        try {
            serverErrorHandler.handle(request, response, cause);
        } catch (Throwable handlingEx) {
            final String msg = "Failed to handle '500 Error' by the handler: " + serverErrorHandler;
            if (errorLogging) {
                logger.error(msg, handlingEx);
            } else {
                logger.debug(msg, handlingEx);
            }
        }
    }
199604
protected void writeError(final ApiRequest request, final HttpServletResponse resp, final Throwable error) {
        getErrorWriter().write(request, error, new IApiClientResponse() {
            @Override
            public void write(StringBuffer buffer) {
                write(buffer.toString());
            }

            @Override
            public void write(StringBuilder builder) {
                write(builder.toString());
            }

            @Override
            public void write(String body) {
                try {
                    resp.getOutputStream().write(body.getBytes("UTF-8")); //$NON-NLS-1$
                    resp.getOutputStream().flush();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

            /**
             * @see io.apiman.gateway.engine.IApiClientResponse#setStatusCode(int)
             */
            @Override
            public void setStatusCode(int code) {
                resp.setStatus(code);
            }

            @Override
            public void setHeader(String headerName, String headerValue) {
                resp.setHeader(headerName, headerValue);
            }
        });
    }
392262
protected void handleConfigureRequestFailure(MemberState member, ConfigureRequest request, Throwable error) {
    // Log the failed attempt to contact the member.
    failAttempt(member, error);
  }
568413
protected void writeFailure(final ApiRequest request, final HttpServletResponse resp, final PolicyFailure policyFailure) {
        getFailureWriter().write(request, policyFailure, new IApiClientResponse() {
            @Override
            public void write(StringBuffer buffer) {
                write(buffer.toString());
            }

            @Override
            public void write(StringBuilder builder) {
                write(builder.toString());
            }

            @Override
            public void write(String body) {
                try {
                    resp.getOutputStream().write(body.getBytes("UTF-8")); //$NON-NLS-1$
                    resp.getOutputStream().flush();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

            /**
             * @see io.apiman.gateway.engine.IApiClientResponse#setStatusCode(int)
             */
            @Override
            public void setStatusCode(int code) {
                resp.setStatus(code);
            }

            @Override
            public void setHeader(String headerName, String headerValue) {
                resp.setHeader(headerName, headerValue);
            }
        });
    }
1363790
private void handleActionException(String target, HttpServletRequest request, HttpServletResponse response, Action action, ActionException e) {
		int errorCode = e.getErrorCode();
		String msg = null;
		if (errorCode == 404) {
			msg = "404 Not Found: ";
		} else if (errorCode == 400) {
			msg = "400 Bad Request: ";
		} else if (errorCode == 401) {
			msg = "401 Unauthorized: ";
		} else if (errorCode == 403) {
			msg = "403 Forbidden: ";
		}
		
		if (msg != null) {
			if (log.isWarnEnabled()) {
				String qs = request.getQueryString();
				msg = msg + (qs == null ? target : target + "?" + qs);
				if (e.getMessage() != null) {
					msg = msg + "\n" + e.getMessage();
				}
				log.warn(msg);
			}
		} else {
			if (log.isErrorEnabled()) {
				String qs = request.getQueryString();
				log.error(errorCode + " Error: " + (qs == null ? target : target + "?" + qs), e);
			}
		}
		
		e.getErrorRender().setContext(request, response, action.getViewPath()).render();
	}
631641
function httpInternalError(req, res, err) {
    console.error(err);
    res.writeHead(500, { 'Content-Type': 'text/plain' });
    res.write(`Error 500 Internal server error: ${err}`);
    res.end();
}
836026
function(res, text, httpStatus) {
		processLogger.log('fatal/request', text);
		apiUtils.errorResponse(res, text, httpStatus || 404);
	}
869603
protected void onRequestError(final RequestErrorEvent event) {
        LOGGER.log(Level.INFO, "onRequestError: {0}", event.getCrawlCandidate().getRequestUrl());
    }
1040962
protected void load(final Request request) throws IOException {
		log("load(" + request + ')');
		final CallbackHandler handler = request.handler != null ? request.handler : this.handler;
		final boolean safe = request.safe != null ? request.safe : this.safe;
		Callback callback = request.callback != null ? request.callback.get() : null;

		// Don't load if URL is the favorites key
		if(request.url.equals(KEY_FAVORITES)) {
			log("Favorites URL detected, skipping load...");
			return;
		}

		// Notify callback
		handler.onPreload(safe, callback);

		// Create safe url for pagination/indexing purposes
		String safeUrl = request.downloader == null ? downloader.toSafeUrl(request) : request.downloader.toSafeUrl(request);

		// Put the page index into the request's HashMap
		pageTracker.put(safeUrl, request.page);

		// Get response from this request
		String response = request.downloader == null ? downloader.execute(request) : request.downloader.execute(request);

		// Parse articles from response and inset into global list
		List<Article> newArticles = request.parser == null ? parser.parse(response) : request.parser.parse(response);
		insert(safeUrl, newArticles);

		// Notify callback
		handler.onLoaded(safe, callback, newArticles);
	}
117490
function(err) {

        var message = 'Error occured while performing a JSON-WSP request. ' +
            err.message + '\n' +
            JSON.stringify({
                options : curOpts
            }, null, '  ').yellow;

        logger.error(message);
    }
504714
public static String getError(final HttpServletRequest request) {
		StringBuilder sb = (StringBuilder) request.getAttribute(ERROR_KEY);
		if (sb == null) {
			return "";
		}
		return sb.toString();
	}
884208
function errorPage(res, err) {
		if (err) {
			console.error(err.message);
			res.send(err, {'Content-Type': 'text/plain'}, 500);
		} else {
			res.send(404);
		}
	}