public static function getExceptionMessage(TranslatorInterface $translator, \Exception $exception, $debug = false)
    {
        $message = $translator->trans('domain.database_error', [], 'FxpResource');

        if ($debug) {
            $message .= ' ['.\get_class($exception).']';
        }

        if ($exception instanceof DriverException) {
            return static::extractDriverExceptionMessage($exception, $message, $debug);
        }

        return $debug
            ? $exception->getMessage()
            : $message;
    }