/*Valldation errors are saved in the session after the form submission, and will be displayed to the user
when redirected back to the form.
519799
public static function setError($id, $errors, $element = "")
    {
        if (!is_array($errors)) {
            $errors = array($errors);
        }

        if (empty($_SESSION["form"][$id]["errors"][$element])) {
            $_SESSION["form"][$id]["errors"][$element] = array();
        }

        foreach ($errors as $error) {
            $_SESSION["form"][$id]["errors"][$element][] = $error;
        }
    }
150043
protected function _error()
    {
        $subject = $this->_subject(['success' => false]);

        $this->_trigger('afterVerify', $subject);
        $this->setFlash('error', $subject);
        $this->_trigger('beforeRender', $subject);
    }
388998
def error_summary(model)
      return nil unless model&.respond_to?(:errors)
      return nil unless model.errors&.any?
      contents = render_alert_message(
          {
              "__The form contains #{model.errors.count} error#{model.errors.count == 1 ? '' : 's'}.__" => model.errors.full_messages
          },
          5
      )

      html = '<div id="error_explanation"><div class="alert alert-danger">' + contents[:text]

      unless contents[:script].blank?
        html += <<-EOS
<script type="text/javascript">
//<![CDATA[
#{contents[:script]}
//]]>
</script>
        EOS
      end

      html += '</div></div>'

      html.html_safe
    end
670130
public function RenderErrors () {
		/** @var $this \MvcCore\Ext\Forms\IField */
		$result = "";
		if (
			$this->errors && 
			$this->form->GetErrorsRenderMode() !== \MvcCore\Ext\Forms\IForm::ERROR_RENDER_MODE_ALL_TOGETHER
		) {
			$result .= '<span class="errors">';
			foreach ($this->errors as $key => $errorMessage) {
				$errorCssClass = 'error error-' . $this->name . ' error-' . $key;
				$result .= "<span class=\"$errorCssClass\">$errorMessage</span>";
			}
			$result .= '</span>';
		}
		return $result;
	}
1162760
function throwErrorIfNoChangesMode(creationMode, checkNoChangesMode, oldValue, currValue) {
    if (checkNoChangesMode) {
        var msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
        if (creationMode) {
            msg +=
                " It seems like the view has been created after its parent and its children have been dirty checked." +
                    " Has it been created in a change detection hook ?";
        }
        // TODO: include debug context
        throw new Error(msg);
    }
}
742210
function () {
				if (typeof global.onerror !== "undefined") {
					var self = this;
					global.onerror = function (msg, url, line) {
						self.error("[" + msg + " on line " + line + " of " + url + "]", 0);
					};
					return true;
				} else {
					return false;
				}
			}
171545
void showValidationErrorDialog(CmsValidationResult validationResult) {

        if (validationResult.getErrors().keySet().contains(m_entityId)) {
            getValidationHandler().displayValidation(m_entityId, validationResult);
        }
        String errorLocales = "";
        for (String entityId : validationResult.getErrors().keySet()) {
            String locale = CmsContentDefinition.getLocaleFromId(entityId);
            errorLocales += m_availableLocales.get(locale) + ", ";
        }
        // remove trailing ','
        errorLocales = errorLocales.substring(0, errorLocales.length() - 2);
        CmsErrorDialog dialog = new CmsErrorDialog(
            Messages.get().key(Messages.GUI_VALIDATION_ERROR_1, errorLocales),
            null);
        dialog.center();
    }
577071
@Override
    public String displayError(String pathPrefix) {

        if (pathPrefix == null) {
            pathPrefix = "";
        }
        StringBuffer html = new StringBuffer(512);
        html.append("<table border='0' cellpadding='5' cellspacing='0' style='width: 100%; height: 100%;'>");
        html.append("\t<tr>");
        html.append("\t\t<td style='vertical-align: middle; height: 100%;'>");
        html.append(getHtmlPart("C_BLOCK_START", "Error"));
        html.append("\t\t\t<table border='0' cellpadding='0' cellspacing='0' style='width: 100%;'>");
        html.append("\t\t\t\t<tr>");
        html.append("\t\t\t\t\t<td><img src='").append(pathPrefix).append("resources/error.png' border='0'></td>");
        html.append("\t\t\t\t\t<td>&nbsp;&nbsp;</td>");
        html.append("\t\t\t\t\t<td style='width: 100%;'>");
        html.append("\t\t\t\t\t\tThe Alkacon OpenCms update wizard has not been started correctly!<br>");
        html.append("\t\t\t\t\t\tPlease click <a href='").append(pathPrefix);
        html.append("index.jsp'>here</a> to restart the wizard.");
        html.append("\t\t\t\t\t</td>");
        html.append("\t\t\t\t</tr>");
        html.append("\t\t\t</table>");
        html.append(getHtmlPart("C_BLOCK_END"));
        html.append("\t\t</td>");
        html.append("\t</tr>");
        html.append("</table>");
        return html.toString();
    }
1090918
function(errors) {	
		var i,k;
		if(YAHOO.lang.isArray(errors)) {
			for(i = 0 ; i < errors.length ; i++) {
				k = errors[i][0];
				value = errors[i][1];
				if(this.inputsNames[k]) {
					if(this.inputsNames[k].options.showMsg) {
						this.inputsNames[k].displayMessage(value);
						Dom.replaceClass(this.inputsNames[k].divEl, "inputEx-valid", "inputEx-invalid" );
					}
				}
			}
		}
		else if(YAHOO.lang.isObject(errors)) {
			for(k in errors) {
				if(errors.hasOwnProperty(k)) {
					if(this.inputsNames[k]) {
						if(this.inputsNames[k].options.showMsg) {
							this.inputsNames[k].displayMessage(errors[k]);
							Dom.replaceClass(this.inputsNames[k].divEl, "inputEx-valid", "inputEx-invalid" );
						}
					}
				}
			}
		}
	}
702034
@SuppressWarnings("unused") // expose utility check method to subclasses
    protected FormValidation checkDisplayName(@Nonnull View view, @CheckForNull String value) {
        if (StringUtils.isBlank(value)) {
            // no custom name, no need to check
            return FormValidation.ok();
        }
        for (View v: view.owner.getViews()) {
            if (v.getViewName().equals(view.getViewName())) {
                continue;
            }
            if (StringUtils.equals(v.getDisplayName(), value)) {
                return FormValidation.warning(Messages.View_DisplayNameNotUniqueWarning(value));
            }
        }
        return FormValidation.ok();
    }
668455
public function error($error, $verboseLvl = null, $insertNewline = true)
    {
        $this->simple(null, $verboseLvl, $insertNewline, false, $error);
    }
1139803
protected function registerSessionBinder()
    {
        list($app, $me) = array($this->app, $this);

        $app->booted(function() use ($app, $me)
        {
            // If the current session has an "errors" variable bound to it, we will share
            // its value with all view instances so the views can easily access errors
            // without having to bind. An empty bag is set when there aren't errors.
            if ($me->sessionHasErrors($app))
            {
                $errors = $app['session.store']->get('errors');

                $app['view']->share('errors', $errors);
            }

            // Putting the errors in the view for every view allows the developer to just
            // assume that some errors are always available, which is convenient since
            // they don't have to continually run checks for the presence of errors.
            else
            {
                $app['view']->share('errors', new ViewErrorBag);
            }
        });
    }
1201569
public static function write_error_html($errtitle, $errdetails, $errcode, $backtrace = null) {
		global $USR;
		?>
		<!DOCTYPE HTML>
		<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
			<head>
				<meta charset="UTF-8" />
				<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
				<title><?php echo $errtitle ?></title>
				<style>
					html {
						background-color: #111;
						font-family: sans-serif;
						color: #fff;
					}
					.errbox {
						margin: 3rem;
						padding: 1rem;
						border-radius: 0.5rem;
						background-color: #500;
						border: 1px solid #f00;
					}
					.errbox h1, .errbox h2, .errbox h4 {
						margin: 0;
						padding: 0;
					}
					.errbox h1 {
						text-align: center;
						margin: 1rem 1rem 2rem;
					}
					.errbox h4 {
						margin-bottom: 1rem;
					}
					.errbox > div {
						background-color: #300;
						border: 1px solid #800;
						padding: 1rem;
					}
				</style>
			</head>
			<body>
				<div id="page">
					<div id="subContent">
						<div class="errbox">
							<?php
								echo '<h1>'.$errcode.': '.$errtitle.'</h1>';
								if (!empty($errdetails)) {
									echo '<div><h2>'.$errdetails.'</h2></div>';
								}
								if (!empty($USR) && $USR->is_admin === true && !empty($backtrace)) {
									echo '<div><h4>Backtrace:</h4>'.$backtrace.'</div>';
								}
							?>
						</div>
					</div>
				</div>
			</body>
		</html>
		<?php
	}
481155
public function displayExceptionError()
    {
        $aViewData = $this->getViewData();

        //add all exceptions to display
        $aErrors = $this->_getErrors();

        if (is_array($aErrors) && count($aErrors)) {
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->passAllErrorsToView($aViewData, $aErrors);
        }

        $oSmarty = \OxidEsales\Eshop\Core\Registry::getUtilsView()->getSmarty();
        $oSmarty->assign("Errors", $aViewData["Errors"]);

        // resetting errors from session
        \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('Errors', []);
    }
207359
function (err, req, res) {
    console.error('uncaughtError', req.method + ' ' + req.url);
    this.sendErrorReport(err, req);

    if (req.accepts('html')) {
      this.renderErrorPage('error', err, req, res);
    } else {
      var error = new errors.HTTPError(500, 'Internal Server Error');
      this.renderError(error, req, res);
    }
  }
1167156
private void errorHandling(CmsObject cms, HttpServletRequest req, HttpServletResponse res, Throwable t) {

        // remove the controller attribute from the request
        CmsFlexController.removeController(req);

        boolean canWrite = (!res.isCommitted() && !res.containsHeader("Location"));
        int status = -1;
        boolean isGuest = true;

        if (t instanceof ServletException) {
            ServletException s = (ServletException)t;
            if (s.getRootCause() != null) {
                t = s.getRootCause();
            }
            LOG.error(t.getLocalizedMessage() + " rendering URL " + req.getRequestURL(), t);
        } else if (t instanceof CmsSecurityException) {
            LOG.warn(t.getLocalizedMessage() + " rendering URL " + req.getRequestURL(), t);
            // access error - display login dialog
            if (canWrite) {
                try {
                    m_authorizationHandler.requestAuthorization(req, res, getLoginFormURL(req, res));
                } catch (IOException ioe) {
                    LOG.debug("Error calling authorization handler.", ioe);
                }
                return;
            }
        } else if (t instanceof CmsDbEntryNotFoundException) {
            LOG.warn(t.getLocalizedMessage() + " rendering URL " + req.getRequestURL(), t);
            // user or group does not exist
            status = HttpServletResponse.SC_SERVICE_UNAVAILABLE;
            isGuest = false;
        } else if (t instanceof CmsVfsResourceNotFoundException) {
            LOG.warn(t.getLocalizedMessage() + " rendering URL " + req.getRequestURL(), t);
            // file not found - display 404 error.
            status = HttpServletResponse.SC_NOT_FOUND;
        } else if (t instanceof CmsException) {
            LOG.error(t.getLocalizedMessage() + " rendering URL " + req.getRequestURL(), t);
            if (t.getCause() != null) {
                t = t.getCause();
            }
        } else if (t.getClass().getName().equals("org.apache.catalina.connector.ClientAbortException")) {
            // only log to debug channel any exceptions caused by a client abort - this is tomcat specific
            LOG.debug(t.getLocalizedMessage() + " rendering URL " + req.getRequestURL(), t);
        } else {
            LOG.error(t.getLocalizedMessage() + " rendering URL " + req.getRequestURL(), t);
        }

        if (status < 1) {
            // error code not set - set "internal server error" (500)
            status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
        }
        res.setStatus(status);

        try {
            if ((cms != null) && (cms.getRequestContext().getCurrentUser() != null)) {
                isGuest = isGuest
                    && (cms.getRequestContext().getCurrentUser().isGuestUser()
                        || cms.userInGroup(
                            cms.getRequestContext().getCurrentUser().getName(),
                            OpenCms.getDefaultUsers().getGroupGuests()));
            }
        } catch (CmsException e) {
            // result is false
            LOG.error(e.getLocalizedMessage(), e);
        }

        if (canWrite) {
            res.setContentType("text/html");
            CmsRequestUtil.setNoCacheHeaders(res);
            if ((status != 404)
                && !isGuest
                && (cms != null)
                && (!CmsJsonPartFilter.isJsonRequest(req))
                && !cms.getRequestContext().getCurrentProject().isOnlineProject()) {
                try {
                    res.setStatus(HttpServletResponse.SC_OK);
                    res.getWriter().print(CmsErrorUI.getBootstrapPage(cms, t, req));
                } catch (IOException e) {
                    // can be ignored
                    LOG.error(e.getLocalizedMessage(), e);
                }
            } else {
                try {
                    res.sendError(status, t.toString());
                } catch (IOException e) {
                    // can be ignored
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }
        }
    }
1202756
public function errorAction()
    {
        if ($this->arguments->getValidationResults()->hasErrors()) {
            $errors = [];
            foreach ($this->arguments->getValidationResults()->getFlattenedErrors() as $propertyName => $propertyErrors) {
                foreach ($propertyErrors as $propertyError) {
                    /** @var \Neos\Error\Messages\Error $propertyError */
                    $error = [
                        'severity' => $propertyError->getSeverity(),
                        'message' => $propertyError->render()
                    ];
                    if ($propertyError->getCode()) {
                        $error['code'] = $propertyError->getCode();
                    }
                    if ($propertyError->getTitle()) {
                        $error['title'] = $propertyError->getTitle();
                    }
                    $errors[$propertyName][] = $error;
                }
            }
            $this->throwStatus(409, null, json_encode($errors));
        }
        $this->throwStatus(400);
    }