X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2Fupdater%2Fexception%2FUpdaterException.php;fp=application%2Fupdater%2Fexception%2FUpdaterException.php;h=20aceccfa73edb97a5144a1596ae6dd20371d410;hb=bcf056c9d92e5240e645c76a4cdc8ae159693f9a;hp=0000000000000000000000000000000000000000;hpb=92c6439dbc41d8a2873dfebbc44e30d75c0c473d;p=github%2Fshaarli%2FShaarli.git diff --git a/application/updater/exception/UpdaterException.php b/application/updater/exception/UpdaterException.php new file mode 100644 index 00000000..20aceccf --- /dev/null +++ b/application/updater/exception/UpdaterException.php @@ -0,0 +1,60 @@ +method = $method; + $this->previous = $previous; + $this->message = $this->buildMessage($message); + } + + /** + * Build the exception error message. + * + * @param string $message Optional given error message. + * + * @return string The built error message. + */ + private function buildMessage($message) + { + $out = ''; + if (!empty($message)) { + $out .= $message . PHP_EOL; + } + + if (!empty($this->method)) { + $out .= t('An error occurred while running the update ') . $this->method . PHP_EOL; + } + + if (!empty($this->previous)) { + $out .= ' ' . $this->previous->getMessage(); + } + + return $out; + } +}