From 1c3ba1024ff6b81021968a9329d9b82565a05942 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 31 Jan 2020 11:15:47 -0500 Subject: [PATCH] Update WireException class to support setting message and code --- wire/core/Exceptions.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/wire/core/Exceptions.php b/wire/core/Exceptions.php index 0ae9c2be..2651971a 100644 --- a/wire/core/Exceptions.php +++ b/wire/core/Exceptions.php @@ -8,7 +8,7 @@ * This file is licensed under the MIT license * https://processwire.com/about/license/mit/ * - * ProcessWire 3.x, Copyright 2018 by Ryan Cramer + * ProcessWire 3.x, Copyright 2020 by Ryan Cramer * https://processwire.com * */ @@ -17,7 +17,29 @@ * Generic ProcessWire exception * */ -class WireException extends \Exception {} +class WireException extends \Exception { + /** + * Replace previously set message + * + * @param string $message + * @since 3.0.150 + * + */ + protected function setMessage($message) { + $this->message = $message; + } + + /** + * Replace previously set code + * + * @param int $code + * @since 3.0.150 + * + */ + protected function setCode($code) { + $this->code = $code; + } +} /** * Thrown when access to a resource is not allowed