From 34161ba2823633c42df0bddfe93a8a2f54efd736 Mon Sep 17 00:00:00 2001 From: Gilles Crettenand Date: Tue, 2 Jun 2015 09:25:51 +0200 Subject: [PATCH] Introduce UsageException --- Lib/Exception/UsageException.php | 5 +++++ Lib/WebService.php | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 Lib/Exception/UsageException.php diff --git a/Lib/Exception/UsageException.php b/Lib/Exception/UsageException.php new file mode 100644 index 0000000..af134e6 --- /dev/null +++ b/Lib/Exception/UsageException.php @@ -0,0 +1,5 @@ +func = $params["func"]; unset($params['func']); if (!is_callable(array($this, $this->func))) { - throw new WebException ("CallFunction", "'func' method not available", -3); + throw new UsageException("CallFunction", "'func' method not available", -3); } $rm = new \ReflectionMethod($this, $this->func); @@ -95,10 +95,10 @@ abstract class WebService /* Check the number of arguments. */ if ($nbParams < $nbArgsFix) { - throw new WebException ("CallArgNumber", "you must provide at least " . $nbArgsFix . " arguments", 4); + throw new UsageException("CallArgNumber", "you must provide at least " . $nbArgsFix . " arguments", 4); } if ($nbParams > $nbArgs) { - throw new WebException ("CallArgNumber", "you must provide at most " . $nbArgs . " arguments", 4); + throw new UsageException("CallArgNumber", "you must provide at most " . $nbArgs . " arguments", 4); } $this->log("Calling '".$this->func."'");