Create detail message from an exception.

@return string
776755
protected function createDetailFromException()
    {
        $e = $this->detail;

        if (!$this->detailIncludesStackTrace) {
            return $this->getExceptionMessage($e);
        }

        $message = $this->getExceptionMessage($e);
        $this->additionalDetails['trace'] = $e->getTrace();

        $previous = [];
        $e = $e->getPrevious();
        while ($e) {
            $previous[] = [
                'code'    => (int) $e->getCode(),
                'message' => $this->getExceptionMessage($e),
                'trace'   => $e->getTrace(),
            ];
            $e = $e->getPrevious();
        }
        if (count($previous)) {
            $this->additionalDetails['exception_stack'] = $previous;
        }

        return $message;
    }
786291
protected function getErrorDetails(\Exception $e, $trace = false)
    {
        $msg = $e->getMessage();
        if ($e instanceof DfException) {
            $context = $e->getContext();
            if (is_array($context)) {
                $context = print_r($context, true);
            }
            if (!empty($context)) {
                $msg .= "\nContext: " . $context;
            }
        }

        if ($trace === true) {
            $msg .= "\nTrace:\n" . $e->getTraceAsString();
        }

        return $msg;
    }
497052
protected function getTextMessage($exception)
	{
	    $message = 'Application Exception' . PHP_EOL;
	    $message .= static::getItemTextMessage($exception);
	    while ($exception= $exception->getPrevious()) {
	        $message .= PHP_EOL . 'Previous exception:' . PHP_EOL;
	        $message .= static::getItemTextMessage($exception);
	    }
	    return $message;
	}
1251754
public function getFailureMessage()
    {
        $missingKeys = implode(', ', $this->missingConfiguration);

        $message  = 'The configuration is not complete. ';
        $message .= 'Missing keys are %s. Please provide them as command options.';
        $message = sprintf($message, $missingKeys);

        return $message;
    }
652525
protected function getXmlMessage($exception)
    {
        $xml = "<error>\n  <message>Application Error</message>\n";
        if ($this->options['display_details']) {
            do {
                $xml .= "  <exception>\n";
                $xml .= "    <type>" . get_class($exception) . "</type>\n";
                $xml .= "    <code>" . $exception->getCode() . "</code>\n";
                $xml .= "    <message>" . $this->createCdataSection($exception->getMessage()) . "</message>\n";
                $xml .= "    <file>" . $exception->getFile() . "</file>\n";
                $xml .= "    <line>" . $exception->getLine() . "</line>\n";
                $xml .= "    <trace>" . $this->createCdataSection($exception->getTraceAsString()) . "</trace>\n";
                $xml .= "  </exception>\n";
            } while ($exception = $exception->getPrevious());
        }
        $xml .= "</error>";
        
        return $xml;
    }
1309035
private function getMessage(\Exception $exception)
    {
        $message = $exception->getMessage();

        if ($this->isApiException($exception)) {
            $message = $exception->getMessageWithVariables();
        }

        return $message;
    }
1194598
public function detailAction()
    {
        $interface = isset($_GET["interface"]) ? trim($_GET["interface"]) : "";
        if (empty($interface)) {
            return $this->error();
        }

        try {
            $config = Factory::getServer($interface);
            $reflectionClass = new ReflectionClass($interface);
        } catch (InitiallyRpcException $e) {
            return $this->error();
        } catch (ReflectionException $e) {
            return $this->error();
        }

        include $this->templateDir . "/detailView.php";
    }
342714
private function getErrorMessage()
    {
        $directivesMessage = '';
        $domainsMessage = '';

        if (!empty($this->invalidValues['directives'])) {
            $directivesMessage = "The following directives are invalid:\n- ";
            $directivesMessage .= implode("\n- ", $this->invalidValues['directives']);
        }

        if (!empty($this->invalidValues['domain'])) {
            $domainsMessage = "The following domains are invalid:\n- ";
            $domainsMessage .= implode("\n- ", $this->invalidValues['domain']);
        }

        return $domainsMessage . "\n" . $directivesMessage;
    }
339723
public static function getFormattedExceptionMessage(\Exception $e)
    {
        $name = static::getExceptionNameHierarchy($e);

        list($file, $line, $stackTrace) = static::getOriginalExceptionFileAndLineNumber($e);

        $message = "{$name}: {$e->getMessage()} ({$e->getcode()})\n{$file} {$line}\n{$stackTrace}";

        return $message;
    }
1249818
def make_exception_message(exc):
    
    if str(exc):
        return '%s: %s\n' % (exc.__class__.__name__, exc)
    else:
        return '%s\n' % (exc.__class__.__name__)
1179595
public static function ConvertToString (\Exception $e) {
		return sprintf(
			'#message %s %s(%s) %s',
			static::ConvertinternalEncoding($e->getMessage()),
			static::ConvertinternalEncoding($e->getFile()),
			$e->getLine(),
			static::ConvertinternalEncoding(str_replace(array("\n", "\r", "\r\n"), " ", $e->getTraceAsString()))
		);
	}
739919
protected function renderXmlErrorMessage(Exception $exception)
    {
        $xml = "<error>\n  <message>Slim Application Error</message>\n";
        if ($this->displayErrorDetails) {
            do {
                $xml .= "  <exception>\n";
                $xml .= "    <type>" . get_class($exception) . "</type>\n";
                $xml .= "    <code>" . $exception->getCode() . "</code>\n";
                $xml .= "    <message>" . $this->createCdataSection($exception->getMessage()) . "</message>\n";
                $xml .= "    <file>" . $exception->getFile() . "</file>\n";
                $xml .= "    <line>" . $exception->getLine() . "</line>\n";
                $xml .= "    <trace>" . $this->createCdataSection($exception->getTraceAsString()) . "</trace>\n";
                $xml .= "  </exception>\n";
            } while ($exception = $exception->getPrevious());
        }
        $xml .= "</error>";

        return $xml;
    }
935668
public String getDetailMessage()
    {
        if(errorDetails == null || errorDetails.isEmpty())
            return getMessage();

        StringBuilder sb = new StringBuilder(512);
        sb.append(getMessage());
        sb.append(" [");

        for (int i = 0; i < errorDetails.size(); i++)
        {
            ErrorDetail errorDetail = errorDetails.get(i);
            if(i > 0)
                sb.append(", ");
            sb.append(errorDetail.getMessage());
        }
        sb.append("]");

        return sb.toString();
    }
1145569
def get_details(self):
        

        # create the exception main message according to the type of result
        if isinstance(self.validation_outcome, Exception):

            prefix = 'Validation function [{val}] raised ' if self.display_prefix_for_exc_outcomes else ''

            # new: we now remove  "Root validator was [{validator}]", users can get it through e.validator
            contents = ('Error validating {what}. ' + prefix + '{exception}: {details}')\
                         .format(what=self.get_what_txt(),
                                 val=self.validator.get_main_function_name(),
                                 exception=type(self.validation_outcome).__name__,
                                 details=end_with_dot(str(self.validation_outcome)))

        else:
            contents = 'Error validating {what}: validation function [{val}] returned [{result}].' \
                       ''.format(what=self.get_what_txt(), val=self.validator.get_main_function_name(),
                                 result=self.validation_outcome)

        # return 'Wrong value: [{}]'.format(self.var_value)
        return contents
225836
public function formatException(\Exception $e) {
        $entry = array();

        $entry['class'] = get_class($e);
        $entry['message'] = $e->getMessage();
        $entry['file'] = $e->getFile();
        $entry['line'] = $e->getLine();
        $entry['trace'] = $e->getTraceAsString();

        return $entry;
    }
356665
public function formatException(\Exception $e)
    {
        $message = $e->getMessage();
        if (!$e instanceof PsyException) {
            if ($message === '') {
                $message = \get_class($e);
            } else {
                $message = \sprintf('%s with message \'%s\'', \get_class($e), $message);
            }
        }

        $message = \preg_replace(
            "#(\\w:)?(/\\w+)*/src/Execution(?:Loop)?Closure.php\(\d+\) : eval\(\)'d code#",
            "eval()'d code",
            \str_replace('\\', '/', $message)
        );

        $message = \str_replace(" in eval()'d code", ' in Psy Shell code', $message);

        $severity = ($e instanceof \ErrorException) ? $this->getSeverity($e) : 'error';

        return \sprintf('<%s>%s</%s>', $severity, OutputFormatter::escape($message), $severity);
    }
1298311
public function getErrorMessage( bool $appendPreviousByNewline = false ) : string
   {

      // Getting a optional previous exception
      $prev = $this->getPrevious();

      if ( \is_null( $prev ) )
      {
         // If no previous exception is used
         return \sprintf(
            '%s(%d): %s',
            static::GetCodeName( $this->getCode() ),
            $this->getCode(),
            $this->getMessage()
         );
      }

      // Define the separator between current and previous exception.
      $separator = $appendPreviousByNewline ? "\n" : ' ';

      if ( ( $prev instanceof BelugaError ) )
      {
         return \sprintf(
            '%s(%d): %s%s%s',
            static::GetCodeName( $this->getCode() ),
            $this->getCode(),
            $this->getMessage(),
            $separator,
            $prev->getErrorMessage( $appendPreviousByNewline )
         );
      }

      return \sprintf(
         '%s(%d): %s%s%s',
         static::GetCodeName( $this->getCode() ),
         $this->getCode(),
         $this->getMessage(),
         $separator,
         $prev->getMessage()
      );

   }