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
32 changes: 19 additions & 13 deletions src/RedNovaLabs/Storedge/SDK.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public function getLeads($facility_uuid, $options)
try {
return $this->get($base_url . $facility_uuid . '/leads' . $query);
} catch (BaseException $e) {
echo $e->getMessage();
$this->logErrorAndShowMessage($e);
}
}

Expand All @@ -242,7 +242,7 @@ public function createLead($facility_uuid, array $data)
try {
return $this->post($base_url . $facility_uuid . '/leads', $data);
} catch (BaseException $e) {
echo $e->getMessage();
$this->logErrorAndShowMessage($e);
}
}

Expand All @@ -251,7 +251,7 @@ public function deleteLead($facility_uuid, $lead_uuid, $params)
try {
return $this->delete($base_url . $facility_uuid . '/leads/' . $lead_uuid, $params);
} catch (BaseException $e) {
echo $e->getMessage();
$this->logErrorAndShowMessage($e);
}

}
Expand All @@ -262,7 +262,7 @@ public function updateTenantPATCH($facility_uuid, $tenant_uuid, array $data)
try {
return $this->patch($base_url . $facility_uuid . '/tenants/' . $tenant_uuid, $data);
} catch (BaseException $e) {
echo $e->getMessage();
$this->logErrorAndShowMessage($e);
}

}
Expand All @@ -272,7 +272,7 @@ public function updateTenantPUT($facility_uuid, $tenant_uuid, array $data)
try {
return $this->put($base_url . $facility_uuid . '/tenants/' . $tenant_uuid, $data);
} catch (BaseException $e) {
echo $e->getMessage();
$this->logErrorAndShowMessage($e);
}
}

Expand All @@ -281,7 +281,7 @@ public function signUpTenant($facility_uuid, $tenant_uuid, array $data)
try {
return $this->post($base_url . $facility_uuid . '/tenants/' . $tenant_uuid . '/sign_up', $data);
} catch (BaseException $e) {
echo $e->getMessage();
$this->logErrorAndShowMessage($e);
}
}

Expand All @@ -290,7 +290,7 @@ public function changeTenantPassword($facility_uuid, $tenant_uuid, array $data)
try {
return $this->put($base_url . $facility_uuid . '/tenants/' . $tenant_uuid . '/change_password', $data);
} catch (BaseException $e) {
echo $e->getMessage();
$this->logErrorAndShowMessage($e);
}
}

Expand All @@ -304,7 +304,7 @@ public function getUnitGroups($facility_uuid, $options)
try {
return $this->get($base_url . $facility_uuid . '/unit_groups' . $query);
} catch (BaseException $e) {
echo $e->getMessage();
$this->logErrorAndShowMessage($e);
}
}

Expand All @@ -317,7 +317,7 @@ public function getSpecificUnitGroup($facility_uuid, $unit_group_uuid, $options)
try {
return $this->get($base_url . $facility_uuid . '/unit_groups/' . $unit_group_uuid . $query);
} catch (BaseException $e) {
echo $e->getMessage();
$this->logErrorAndShowMessage($e);
}
}

Expand All @@ -330,7 +330,7 @@ public function getUnitGroupUnits($facility_uuid, $unit_group_uuid, $options)
try {
return $this->get($base_url . $facility_uuid . '/unit_groups/' . $unit_group_uuid . '/units' . $query);
} catch (BaseException $e) {
echo $e->getMessage();
$this->logErrorAndShowMessage($e);
}
}

Expand All @@ -344,7 +344,7 @@ public function getUnits($facility_uuid, $options)
try {
return $this->get($base_url . $facility_uuid . '/units' . $query);
} catch (BaseException $e) {
echo $e->getMessage();
$this->logErrorAndShowMessage($e);
}
}

Expand All @@ -357,7 +357,7 @@ public function getAvailableUnits($facility_uuid, $options)
try {
return $this->get($base_url . $facility_uuid . '/units/available' . $query);
} catch (BaseException $e) {
echo $e->getMessage();
$this->logErrorAndShowMessage($e);
}
}

Expand All @@ -370,8 +370,14 @@ public function getSpecificUnit($facility_uuid, $unit_uuid, $options)
try {
return $this->get($base_url . $facility_uuid . '/units/' . $unit_uuid . $query);
} catch (BaseException $e) {
echo $e->getMessage();
$this->logErrorAndShowMessage($e);
}
}

private function logErrorAndShowMessage($e)
{
error_log($e->getMessage());
echo("Something went wrong with API request. Check error log for details.\n");
}

}