protected function formatThrowable(Exception $ex) {
		$array = array(				
			'message' => $ex->getMessage(),
			'code' => $ex->getCode(),
			'stackTrace' => $ex->getTraceAsString(),
		);
        
		if (method_exists($ex, 'getPrevious') && $ex->getPrevious() !== null) {
			$array['innerException'] = $this->formatThrowable($ex->getPrevious());
		}
		
		return $array;
	}
protected function formatThrowable(Exception $ex) {
		$array = array(				
			'message' => $ex->getMessage(),
			'code' => $ex->getCode(),
			'stackTrace' => $ex->getTraceAsString(),
		);
        
		if (method_exists($ex, 'getPrevious') && $ex->getPrevious() !== null) {
			$array['innerException'] = $this->formatThrowable($ex->getPrevious());
		}
		
		return $array;
	}
protected function formatThrowable ( Exception $ ex ) { $ array = array ( 'message' => $ ex -> getMessage ( ) , 'code' => $ ex -> getCode ( ) , 'stackTrace' => $ ex -> getTraceAsString ( ) , ) ; if ( method_exists ( $ ex , 'getPrevious' ) && $ ex -> getPrevious ( ) !== null ) { $ array [ 'innerException' ] = $ this -> formatThrowable ( $ ex -> getPrevious ( ) ) ; } return $ array ; }
Converts an Exception into an array which can be logged to mongodb.

Supports innner exceptions (PHP >= 5.3)

@param Exception $ex
@return array
Converts an Exception into an array which can be logged to mongodb .