flush
[m6w6/seekat] / lib / API / Call.php
index ba51ca3fe23dbe2d74ef60a2b3bc9afe6974bf00..7eba2a80b7fbfb76f6b7748c728c06797410c357 100644 (file)
@@ -25,26 +25,11 @@ final class Call
        }
 
        function __invoke(array $args) : Promise {
-               $promise = $this->api->{$this->call}->get(...$args);
-
-               /* fetch resource, unless already localized, and try for {$method}_url */
-               if (!$this->api->exists($this->call)) {
-                       $promise->when(function($error, $value) use($args) {
-                               if (!isset($error)) {
-                                       return $value;
-                               }
-                               if ($this->api->exists($this->call."_url", $url)) {
-                                       $url = new Url(uri_template($url, (array)current($args)));
-                                       return $this->api->withUrl($url)->get(...$args);
-                               }
-
-                               $message = Exception\message($error);
-                               $this->api->getLogger()->error("call($this->call): " . $message, [
-                                       "url" => (string) $this->api->getUrl()
-                               ]);
-
-                               throw $error;
-                       });
+               if ($this->api->exists($this->call."_url", $url)) {
+                       $url = new Url(uri_template($url, (array)current($args)));
+                       $promise = $this->api->withUrl($url)->get(...$args);
+               } else {
+                       $promise = $this->api->{$this->call}->get(...$args);
                }
 
                return $promise;