From: Marcel Werk Date: Tue, 2 Jul 2013 19:11:53 +0000 (+0200) Subject: Improved error handling X-Git-Tag: 2.0.0_Beta_5~112 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2a60ea12ef4a1ec5ebfea5e2257ca8fd8c222f23;p=GitHub%2FWoltLab%2FWCF.git Improved error handling --- diff --git a/wcfsetup/install/files/acp/templates/dataImport.tpl b/wcfsetup/install/files/acp/templates/dataImport.tpl index 204ebfa5bd..987bfe7eb8 100644 --- a/wcfsetup/install/files/acp/templates/dataImport.tpl +++ b/wcfsetup/install/files/acp/templates/dataImport.tpl @@ -48,7 +48,7 @@ {if $errorField} -

{lang}wcf.global.form.error{/lang} ({$errorField})

+

{lang}wcf.global.form.error{/lang}

{/if}
@@ -130,7 +130,7 @@ *} -
+ {lang}wcf.acp.dataImport.configure.database{/lang}
@@ -165,6 +165,9 @@
+ {if $errorField == 'database'} + {lang}wcf.acp.dataImport.configure.database.error{/lang} + {/if}
@@ -172,10 +175,13 @@
{lang}wcf.acp.dataImport.configure.fileSystem{/lang} -
+
+ {if $errorField == 'fileSystemPath'} + {lang}wcf.acp.dataImport.configure.fileSystem.path.error{/lang} + {/if} {lang}wcf.acp.dataImport.configure.fileSystem.path.description{/lang}
diff --git a/wcfsetup/install/files/lib/acp/form/DataImportForm.class.php b/wcfsetup/install/files/lib/acp/form/DataImportForm.class.php index 55707c6b21..c65438580f 100644 --- a/wcfsetup/install/files/lib/acp/form/DataImportForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/DataImportForm.class.php @@ -2,6 +2,7 @@ namespace wcf\acp\form; use wcf\data\object\type\ObjectTypeCache; use wcf\form\AbstractForm; +use wcf\system\database\DatabaseException; use wcf\system\exception\IllegalLinkException; use wcf\system\exception\UserInputException; use wcf\system\WCF; @@ -165,7 +166,11 @@ class DataImportForm extends AbstractForm { $this->exporter->setData($this->dbHost, $this->dbUser, $this->dbPassword, $this->dbName, $this->dbPrefix, $this->fileSystemPath); // validate database Access - if (!$this->exporter->validateDatabaseAccess()) { + try { + $this->exporter->validateDatabaseAccess(); + } + catch (DatabaseException $e) { + WCF::getTPL()->assign('exception', $e); throw new UserInputException('database'); } diff --git a/wcfsetup/install/files/lib/system/exporter/AbstractExporter.class.php b/wcfsetup/install/files/lib/system/exporter/AbstractExporter.class.php index 5b901c8b30..8a9a6d7499 100644 --- a/wcfsetup/install/files/lib/system/exporter/AbstractExporter.class.php +++ b/wcfsetup/install/files/lib/system/exporter/AbstractExporter.class.php @@ -99,14 +99,7 @@ abstract class AbstractExporter implements IExporter { * @see wcf\system\exporter\IExporter::validateDatabaseAccess() */ public function validateDatabaseAccess() { - try { - $this->init(); - } - catch (DatabaseException $e) { - return false; - } - - return true; + $this->init(); } /** diff --git a/wcfsetup/install/files/lib/system/exporter/IExporter.class.php b/wcfsetup/install/files/lib/system/exporter/IExporter.class.php index fed6217f08..4f885294c3 100644 --- a/wcfsetup/install/files/lib/system/exporter/IExporter.class.php +++ b/wcfsetup/install/files/lib/system/exporter/IExporter.class.php @@ -46,9 +46,9 @@ interface IExporter { public function exportData($objectType, $loopCount = 0); /** - * Validates database access. Returns false on failure. + * Validates database access. * - * @return boolean + * @throws wcf\system\database\DatabaseException */ public function validateDatabaseAccess(); diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index e68708797c..657060b9ef 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -173,6 +173,8 @@ + + @@ -182,6 +184,9 @@ + {$exception->getMessage()}
{$exception->getErrorDesc()}
]]>
+ diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 24fea6185e..880bdcbc0c 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -172,6 +172,8 @@ Examples for medium ID detection: + + @@ -181,6 +183,9 @@ Examples for medium ID detection: + {$exception->getMessage()}
{$exception->getErrorDesc()}
]]>
+