Render a default HTML "Whitelabel Error Page".
<p>
Useful when no other error view is available in the application.
@param responseBody the error response being built
@param error the error data as a map
@return a Publisher of the {@link ServerResponse}
11777
protected Mono<ServerResponse> renderDefaultErrorView(
			ServerResponse.BodyBuilder responseBody, Map<String, Object> error) {
		StringBuilder builder = new StringBuilder();
		Date timestamp = (Date) error.get("timestamp");
		Object message = error.get("message");
		Object trace = error.get("trace");
		Object requestId = error.get("requestId");
		builder.append("<html><body><h1>Whitelabel Error Page</h1>").append(
				"<p>This application has no configured error view, so you are seeing this as a fallback.</p>")
				.append("<div id='created'>").append(timestamp).append("</div>")
				.append("<div>[").append(requestId)
				.append("] There was an unexpected error (type=")
				.append(htmlEscape(error.get("error"))).append(", status=")
				.append(htmlEscape(error.get("status"))).append(").</div>");
		if (message != null) {
			builder.append("<div>").append(htmlEscape(message)).append("</div>");
		}
		if (trace != null) {
			builder.append("<div style='white-space:pre-wrap;'>")
					.append(htmlEscape(trace)).append("</div>");
		}
		builder.append("</body></html>");
		return responseBody.syncBody(builder.toString());
	}
181931
@SuppressWarnings("rawtypes")
    private ModelAndView buildError(ModelAndView mvc, ResultCode error) {
        mvc.addObject("data", new ArrayList(0));
        mvc.addObject("status", error.getCode());
        Map<String, Object> statusInfo = Maps.newHashMapWithExpectedSize(1);
        statusInfo.put(WebResponseConstant.MESSAGE_GLOBAL, error.getMessage().getMessage());
        mvc.addObject("statusInfo", statusInfo);
        mvc.addObject("msg", error.getMessage().getMessage());
        return mvc;
    }
828842
def server_error(request, template_name='500.html'):
    

    response = render_in_page(request, template_name)

    if response:
        return response

    try:
        template = loader.get_template(template_name)
    except TemplateDoesNotExist:
        return http.HttpResponseServerError('<h1>Server Error (500)</h1>', content_type='text/html')
    return http.HttpResponseServerError(template.render(Context({})))
750066
protected void throwIfErrorResponse(RESTResponse response) {
        if (response.getCode().isError()) {
            String errMsg = response.getBody();
            if (Utils.isEmpty(errMsg)) {
                errMsg = "Unknown error; response code: " + response.getCode();
            }
            throw new RuntimeException(errMsg);
        }
    }
695738
public Javalin error(int statusCode, @NotNull ErrorHandler errorHandler) {
        servlet.getErrorMapper().getErrorHandlerMap().put(statusCode, errorHandler);
        return this;
    }
535704
@Path("{snapshotId}/error")
    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public Response error(@PathParam("snapshotId") String snapshotId,
                          SnapshotErrorBridgeParameters params) {
        try {
            Snapshot snapshot =
                snapshotManager.transferError(snapshotId, params.getError());
            log.info("Processed snapshot error notification: {}", snapshot);

            return Response.ok(new SnapshotErrorBridgeResult(snapshot.getStatus(),
                                                             snapshot.getStatusText()))
                           .build();
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
            return Response.serverError()
                           .entity(new ResponseDetails(ex.getMessage()))
                           .build();
        }
    }
191372
private static Label createErrorLabel() {

        Label label = new Label();
        label.addStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll());
        label.addStyleName(I_CmsInputLayoutBundle.INSTANCE.inputCss().error());
        return label;
    }
1106829
protected String renderErrorPageToHTML(final WComponent errorPage) {

		// Check if using the default error page
		boolean defaultErrorPage = errorPage instanceof FatalErrorPage;

		String html = null;

		// If not default implementation of error page, Transform error page to HTML
		if (!defaultErrorPage) {
			// Set UIC and Environment (Needed for Theme Paths)
			UIContext uic = new UIContextImpl();
			uic.setEnvironment(createEnvironment());
			UIContextHolder.pushContext(uic);
			try {
				html = WebUtilities.renderWithTransformToHTML(errorPage);
			} catch (Exception e) {
				LOG.warn("Could not transform error page.", e);
			} finally {
				UIContextHolder.popContext();
			}
		}

		// Not transformed. So just render.
		if (html == null) {
			UIContextHolder.pushContext(new UIContextImpl());
			try {
				html = WebUtilities.render(errorPage);
			} catch (Exception e) {
				LOG.warn("Could not render error page.", e);
				html = "System error occurred but could not render error page.";
			} finally {
				UIContextHolder.popContext();
			}
		}

		return html;
	}
1373002
function internalError(response, message, body) {
  var content = errorContent(ErrorType.server, message, body);
  send(response, content, StatusCode.internalServerError);
}
248803
public String getErrorPage(String error)
    {
        if (_errorPages == null)
            return null;
        return (String)_errorPages.get(error);
    }
789683
public static SafeHtml formatErrorHtml(String error) {

        String text;
        String cssClass;
        String title = "";

        if (error == null) {
            text = CmsAliasMessages.messageStatusOk();
            cssClass = STATUS_OK;
        } else {
            text = CmsAliasMessages.messageStatusError();
            title = SafeHtmlUtils.htmlEscape(error);
            cssClass = STATUS_ERROR;
        }
        String html = "<div class='" + cssClass + "' title='" + title + "'>" + text + "</div>";
        return SafeHtmlUtils.fromSafeConstant(html);
    }
813518
function htmlError(result, cb) {
  var message = result.body
    .match(/<h1>Error<\/h1>.+<\/p>/).toString()
    .replace(/<h1>Error<\/h1>/, '')
    .replace(/<\/?p>/g, '');
  cb(new Error(message));
}
730689
function apiError(response, error) {
  var content = errorContentExt(ErrorType.server, error);
  send(response, content, StatusCode.internalServerError);
}
926571
function expressResponseError(response, error, message) {
  let errorMessage = "there was an error in the request";
  if(message)
    errorMessage = message
  response.json({ success: false, error: errorMessage });
  console.error(error);
}
1200479
public void setErrorPage(String error, String uriInContext)
    {
        if (_errorPages == null)
            _errorPages= new HashMap();
        _errorPages.put(error, uriInContext);
    }
583486
public void sendError(int code,String message) 
        throws IOException
    {        
        setStatus(code,message);
        
        // Generate normal error page.
        HttpRequest request=getHttpRequest();
        
        // If we are allowed to have a body 
        if (code!=__204_No_Content &&
            code!=__304_Not_Modified &&
            code!=__206_Partial_Content &&
            code>=200)
        {
            if (getHttpContext()!=null)
            {   
                Object o=
                    getHttpContext().getAttribute(HttpContext.__ErrorHandler);
                if (o!=null && o instanceof HttpHandler)
                    ((HttpHandler)o).handle(request.getPath(), null, request, this);
            }
        }
        else if (code!=__206_Partial_Content) 
        {
            _header.remove(HttpFields.__ContentType);
            _header.remove(HttpFields.__ContentLength);
            _characterEncoding=null;
            _mimeType=null;
        }
        
        commit();
    }
834834
void sendError( ServletRequest request, ServletResponse response, ServletContext servletContext,
                    int productionTimeErrorCode )
        throws IOException
    {
        InternalUtils.sendDevTimeError( _messageKeyPrefix, getMessageArgs(), null, productionTimeErrorCode,
                                        request, response, servletContext );
    }