add logging; fix caching
[pharext/pharext.org] / app / Github / Exception / RequestException.php
index 49ea1ae72f9a5db3fa805299cb48b732bfb886e9..c0a3d33c71524b3438dc7528759460763d839c6d 100644 (file)
@@ -47,10 +47,15 @@ class RequestException extends \Exception implements Exception
                
                $errors = "JSON errors:\n";
                foreach ($this->errors as $error) {
-                       $errors .= sprintf($reasons[$error->code], $error->resource, $error->field);
+                       if ($error->code === "custom") {
+                               $errors .= $error->message . "\n";
+                       } else {
+                               $errors .= sprintf($reasons[$error->code], $error->resource, $error->field);
+                       }
                }
                return $errors;
        }
+       
        function __toString() {
                return parent::__toString() . "\n". $this->getErrorsAsString();
        }