Code Duplication    Length = 3-7 lines in 2 locations

src/API.php 2 locations

@@ 382-388 (lines=7) @@
379
        $result = json_decode($result);
380
381
        // Check for errors
382
        if (isset($result->error)) {
383
            if ($result->error == 1301) {
384
            	// item not found
385
            	return array();
386
            }
387
            throw new \Exception("Error listing path " . $path . ": (" . $result->error . ") '" . $result->message . "'");
388
        }
389
390
        return $result;
391
    }
@@ 679-681 (lines=3) @@
676
        $result = json_decode($result);
677
        
678
        // Check for errors
679
        if (isset($result->error)) {
680
               throw new \Exception("Error creating link for paths " . implode(', ', $paths) . ": (" . $result->error . ") '" . $result->message . "'");
681
        }
682
        
683
        return $result;
684
    }