Default exception handling method. Rolls back the transaction and
executes 'failure' action.
@param $exception The Exception instance
190849
public function handleException(\Exception $exception) {
    // get error level
    $logFunction = 'error';
    if ($exception instanceof ApplicationException) {
      $logFunction = $exception->getError()->getLevel() == ApplicationError::LEVEL_WARNING ?
              'warn' : 'error';
    }
    self::$logger->$logFunction($exception);

    try {
      if (ObjectFactory::getInstance('configuration') != null) {
        // rollback current transaction
        $persistenceFacade = ObjectFactory::getInstance('persistenceFacade');
        $persistenceFacade->getTransaction()->rollback();

        // redirect to failure action
        if ($this->request) {
          $error = ApplicationError::fromException($exception);
          $this->request->addError($error);
          $this->response->addError($error);
          $this->request->setAction('failure');
          $this->response->setAction('failure');
          $this->response->setStatus($error->getStatusCode());
          ObjectFactory::getInstance('actionMapper')->processAction($this->request, $this->response);
          return;
        }
      }
      throw $exception;
    }
    catch (\Exception $ex) {
      self::$logger->error($ex->getMessage()."\n".$ex->getTraceAsString());
    }
  }
874332
public function wrapAndHandleException($exception)
    {
        if ($exception instanceof Error) {
            $exception = new PHP7ErrorException($exception);
        }
        $this->handleException($exception);
    }
838466
public function api_exception_handler( $exception ) {
		// If we have a verbose exception
		if ( $exception instanceOf ApiVerboseException ) {
			$more_info = $exception->getMoreInfo();
		}
		else {
			$more_info = null;
		}

		// Let's handle the exception gracefully
		$this->abort(
			$exception->getCode(),
			$exception->getSlug(), // ApiException interface method
			$exception->getMessage(),
			$more_info
		);
	}
983710
public function handleException($exception)
    {
        $isHandled = false;
        try {
            $isHandled = $this->handler->handle($exception);
        } catch (Exception $ex) {
        } catch (Throwable $ex) {
        }

        // Bomb out if handler returns true, since was able to render something to the client
        if ($isHandled) {
            exit;
        }

        // Rethrow to be handled by default php exception handling.
        throw $exception;
    }
536931
public function error($exception)
    {
        $response = new Response();

        // Set the default error response
        $response->setContent('There has been a problem serving this request.');
        $response->headers->set('content-type', 'text/html');
        $response->setStatusCode(Response::HTTP_INTERNAL_SERVER_ERROR);

        // Execute the user defined error callback
        if (is_callable($this->error)) {
            $response = call_user_func($this->error, $response, $exception);
        }

        // Send the response
        $response->send();
    }
1182574
public function handleException(Exception $exception)
    {
        $severity = method_exists($exception, 'getSeverity') ? $exception->getSeverity() : self::ERROR_LEVEL;
        self::singleton()
            ->log(
                $severity,
                $exception->getMessage(),
                [
                    self::CONTEXT_EXCEPTION => get_class($exception),
                    self::CONTEXT_ERROR_FILE => $exception->getFile(),
                    self::CONTEXT_ERROR_LINE => $exception->getLine(),
                    self::CONTEXT_TRACE => $exception->getTrace()
                ]
            );
    }
807687
public function handleException(Exception $exception)
    {
        $this->_sendFatalError("Fatal proxy Exception: '"
                               . $exception->getMessage()
                               . "' in "
                               . $exception->getFile()
                               . ":"
                               . $exception->getLine());
    }
1260024
public function exceptionHandler(Exception $exception)
    {
        $this->logger->addError($exception->getMessage(), array($exception->getFile(), $exception->getLine()));
        exit(-1);
    }
822439
protected function handleException(BaseException $exception)
    {
        if (!$this->errorsAsWarnings) {
            throw $exception;
        }
        $this->io->write('<error>'.$exception->getMessage().'</error>');
    }
725889
public static function exception($exception): void
    {
        self::getInstance()->error(
            $exception->getMessage() . ' [' .
            $exception->getFile() . ':' .
            $exception->getLine() . ']'
        );
    }
612412
public function logException(\Exception $exception)
    {
        $this->logError('Error: ' . get_class($exception) . ' - ' . $exception->getMessage() . ' (Code: ' . $exception->getCode() . ')');
        $this->logError('File: ' . $exception->getFile() . ' / Line: ' . $exception->getLine());
    }
1207570
protected function handleException(\Exception $exception)
    {
        $this->response->setStatus(500);
        // may be we want also an exceptionHandler e.g. to notify somebody, ...
        $this->addFlashMessage(
            $exception->getMessage(),
            get_class($exception),
            Message::SEVERITY_ERROR,
            [],
            $exception->getCode()
        );
    }
910927
public function setException(\Exception $exception = null)
    {
        $this->exception = $exception;
        $this->result = self::FAILED;
    }
71172
public function handle($exception) {
        $message = $exception->getMessage();

        // Add the exception backtrace for developers.
        if (debugging('', DEBUG_DEVELOPER)) {
            $message .= "\n".format_backtrace(get_exception_info($exception)->backtrace, true);
        }

        // Switch to response.
        $type = str_replace('Request', 'Response', $this->type);

        // Build the appropriate xml.
        $response = lti_get_response_xml('failure', $message, $this->id, $type);

        $xml = $response->asXML();

        // Log the request if necessary.
        if ($this->log) {
            lti_log_response($xml, $exception);
        }

        echo $xml;
    }
128762
public function errorhandler($exception) {
		$errstr		= $exception->getMessage();
		$errcode	= $exception->getCode();
		$backtrace	= $exception->getTrace();
		
		// the same should not be outputted more than once
		if ($errstr == $this->lasterror) return;
		$this->lasterror = $errstr;

		// count errors to produce unique ids
		$this->errorcounter++;

		// if it is an error throw away the first backtrace item
		if ($exception instanceof ErrorException) array_shift($backtrace);
		
		// add actual error to backtrace
		$bt['file'] = $exception->getFile();
		$bt['line'] = $exception->getLine();
		array_unshift($backtrace, $bt);
		
		// clean array
		$backtrace_keys = ['file'=>'', 'line'=>'', 'class'=>'', 'object'=>'', 'type'=>'', 'function'=>'', 'args'=>[]];
		foreach ($backtrace as $key => $value) {
			$backtrace[$key] = array_merge($backtrace_keys, $value);
		}
		
		// set the error code string
		if ($exception instanceof ErrorException) $errordescription = $this->errortypes[ $exception->getSeverity() ];
		elseif ($errcode == 0) $errordescription = 'EXCEPTION';
		else $errordescription = 'EXCEPTION (Code '.$errcode.')';

		// show error on screen
		if (!is_int($this->config['output']['screen'])) {
			die(__CLASS__ . ': debug.output.screen has to a valid PHP timestamp.');
		}

		if (time() < $this->config['output']['screen']) {
			$error = $this->_errorhandler_output($errstr, $backtrace, $errordescription);
			echo $error;
		}

		// log error in logfile
		if (!is_int($this->config['output']['file'])) {
			die(__CLASS__ . ': debug.output.file has to a valid PHP timestamp.');
		}

		if (time() < $this->config['output']['file']) {
			$this->_errorhandler_file($errstr, $backtrace, $errordescription);
		}

		// trigger event/hook
		if ($this->_event_object !== null) {
			$this->_event_object->trigger('core.after_exception', $exception);
		}
	}
801958
public function fail($exception)
    {
        $this->resqueInstance->events->trigger('onFailure', [
            'exception' => $exception,
            'job' => $this
        ]);

        if(isset($this->status)) {
            $this->status->update(ResqueJobStatus::STATUS_FAILED);
        }

        $this->resqueInstance->stats->incr('failed');
        $this->resqueInstance->stats->incr('failed:' . $this->worker);
        if ($this->resqueInstance->backend->recreateFailedJobs) {
            $this->recreate();
        }
    }
724181
public function handleExceptions($exception)
    {
        $this->displayError($exception);
        $this->sendErrorNotification($exception);

        if(isset($this->ApplicationContext) && ($this->ApplicationContext->isOneOffRedeploy() || $this->redeployOnError))
            $this->ApplicationContext->clearContextFiles();
    }