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;
    }