From bcf056c9d92e5240e645c76a4cdc8ae159693f9a Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Mon, 3 Dec 2018 23:49:20 +0100 Subject: namespacing: \Shaarli\Updater Signed-off-by: VirtualTam --- application/updater/exception/UpdaterException.php | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 application/updater/exception/UpdaterException.php (limited to 'application/updater/exception/UpdaterException.php') 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; + } +} -- cgit v1.2.3