From 70a9d64b67d0850fa2971ff27595b7a8d8dc170f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Alejandro=20L=C3=B3pez=20L=C3=B3pez?= Date: Wed, 28 Feb 2024 22:50:00 -0500 Subject: [PATCH] Include explanatory message in thrown exception The exception had no message and was required to explore the source code to understand the reason. The variable holding the message was there, but unused. --- src/Validation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Validation.php b/src/Validation.php index d74786a..f83d8d3 100644 --- a/src/Validation.php +++ b/src/Validation.php @@ -499,7 +499,7 @@ protected function resolveRules($rules): array } else { $ruleName = is_object($rule) ? get_class($rule) : gettype($rule); $message = "Rule must be a string, Closure or '".Rule::class."' instance. ".$ruleName." given"; - throw new \Exception(); + throw new \Exception($message); } $resolvedRules[] = $validator;