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=ff3b5dc5542ec150f0d9b447394364a15e9156d0;hp=0000000000000000000000000000000000000000;hpb=1826e383ecf501302974132fd443cf1ca06e10f6;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; + } +}