static public function formatMessage(\Exception $e, $withClassName = true) 
    {
        $returnValue = '';
        
        do {
            $className = get_class($e);
            $message = $e->getMessage();
            $returnValue .= ($withClassName === true) ? "[${className}] ${message}" : $message;
            
            if ($e = $e->getPrevious()) {
                $returnValue .= "\nCaused by:\n";
            }
        } while ($e);
        
        return $returnValue;
    }
static public function formatMessage(\Exception $e, $withClassName = true) 
    {
        $returnValue = '';
        
        do {
            $className = get_class($e);
            $message = $e->getMessage();
            $returnValue .= ($withClassName === true) ? "[${className}] ${message}" : $message;
            
            if ($e = $e->getPrevious()) {
                $returnValue .= "\nCaused by:\n";
            }
        } while ($e);
        
        return $returnValue;
    }
static public function formatMessage ( \ Exception $ e , $ withClassName = true ) { $ returnValue = '' ; do { $ className = get_class ( $ e ) ; $ message = $ e -> getMessage ( ) ; $ returnValue .= ( $ withClassName === true ) ? "[${className}] ${message}" : $ message ; if ( $ e = $ e -> getPrevious ( ) ) { $ returnValue .= "\nCaused by:\n" ; } } while ( $ e ) ; return $ returnValue ; }
Format an Exception message.

This method will format an exception message using the following scheme:

[CLASSNAME] MESSAGE

If the Exception contains previous exceptions, the following scheme will be used:

[CLASSNAME] MESSAGE
Caused by:
[CLASSNAME] MESSAGE
...

@param \Exception $e A PHP Exception object.
@param true $withClassName Whether to show the Exception class name.
Format an Exception message .