Piwik\Tracker\Response::getMessageFromException PHP Method

getMessageFromException() protected method

Gets the error message to output when a tracking request fails.
protected getMessageFromException ( Exception $e ) : string
$e Exception
return string
    protected function getMessageFromException($e)
    {
        // Note: duplicated from FormDatabaseSetup.isAccessDenied
        // Avoid leaking the username/db name when access denied
        if ($e->getCode() == 1044 || $e->getCode() == 42000) {
            return "Error while connecting to the Piwik database - please check your credentials in config/config.ini.php file";
        }
        if (Common::isPhpCliMode()) {
            return $e->getMessage() . "\n" . $e->getTraceAsString();
        }
        return $e->getMessage();
    }

Usage Example

コード例 #1
0
ファイル: ResponseTest.php プロジェクト: diosmosis/piwik
 public function getMessageFromException($e)
 {
     return parent::getMessageFromException($e);
 }