fix error handling of register request with unknown transport
This commit is contained in:
parent
066d89873a
commit
41b3d84e9d
1 changed files with 18 additions and 19 deletions
|
@ -123,27 +123,26 @@ class SubscriptionManagementPlugin extends ServerPlugin {
|
||||||
|
|
||||||
$transport = $this->transportManager->getTransport($subscriptionType);
|
$transport = $this->transportManager->getTransport($subscriptionType);
|
||||||
|
|
||||||
if($transport === null) {
|
if(!is_null($transport)) {
|
||||||
|
[
|
||||||
|
'success' => $registerSuccess,
|
||||||
|
'error' => $registerError,
|
||||||
|
'responseStatus' => $responseStatus,
|
||||||
|
'response' => $responseContent,
|
||||||
|
'unsubscribeLink' => $unsubscribeLink,
|
||||||
|
'data' => $data
|
||||||
|
] = $transport->registerSubscription($subscriptionOptions);
|
||||||
|
|
||||||
|
$responseStatus = $responseStatus ?? Http::STATUS_CREATED;
|
||||||
|
$data = $data ?? False;
|
||||||
|
|
||||||
|
if(!$registerSuccess) {
|
||||||
|
$errors[] = $registerError;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$errors[] = $subscriptionType . " transport does not exist";
|
$errors[] = $subscriptionType . " transport does not exist";
|
||||||
}
|
}
|
||||||
|
|
||||||
[
|
|
||||||
'success' => $registerSuccess,
|
|
||||||
'error' => $registerError,
|
|
||||||
'responseStatus' => $responseStatus,
|
|
||||||
'response' => $responseContent,
|
|
||||||
'unsubscribeLink' => $unsubscribeLink,
|
|
||||||
'data' => $data
|
|
||||||
] = $transport->registerSubscription($subscriptionOptions);
|
|
||||||
|
|
||||||
$responseStatus = $responseStatus ?? Http::STATUS_CREATED;
|
|
||||||
$data = $data ?? False;
|
|
||||||
|
|
||||||
|
|
||||||
if(!$registerSuccess) {
|
|
||||||
$errors[] = $registerError;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(sizeof($errors) == 0) {
|
if(sizeof($errors) == 0) {
|
||||||
$response->setStatus($responseStatus);
|
$response->setStatus($responseStatus);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue