Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 33 additions & 14 deletions JunosSpace.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function setHTTPHeaders($headers)
$this->restlyte->setHTTPHeaders($headers);
}


/**
* @return mixed
*/
Expand Down Expand Up @@ -98,31 +97,54 @@ public function setUsername($username)

public function get($path, $accepts='')
{
return $this->request('get', $path, $accepts);
try {
return $this->request('get', $path, $accepts);
}
catch( \Exception $e ) {
throw new \Exception($e->getMessage());
}

}

public function post($path, $postData, $accepts='')
{
return $this->request('post', $path, $accepts, $postData);
try {
return $this->request('post', $path, $accepts, $postData);
}
catch( \Exception $e ) {
throw new \Exception($e->getMessage());
}
}

public function put($path, $postData, $accepts='')
{
return $this->request('put', $path, $accepts, $postData);
try {
return $this->request('put', $path, $accepts, $postData);
}
catch( \Exception $e ) {
throw new \Exception($e->getMessage());
}

}

public function patch($path, $postData, $accepts='')
{
return $this->request('patch', $path, $accepts, $postData);

try {
return $this->request('patch', $path, $accepts, $postData);
}
catch( \Exception $e ) {
throw new \Exception($e->getMessage());
}
}

public function delete($path, $postData, $accepts='')
{

return $this->request('delete', $path, $accepts, $postData);

try {
return $this->request('delete', $path, $accepts, $postData);
}
catch( \Exception $e ) {
throw new \Exception($e->getMessage());
}
}

public function request($verb, $path, $accepts='', $postData='')
Expand All @@ -149,10 +171,7 @@ public function request($verb, $path, $accepts='', $postData='')
}
}
catch (\Exception $e) {

$this->whatIsResponseError($e);


throw new \Exception($e->getMessage());
}

return $response;
Expand Down Expand Up @@ -241,4 +260,4 @@ public function whatIsResponseError(\Exception $e)

}

}
}