Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm not sure if the current exception behaviour is intended or not.
In services_client_make_node_call() we make a couple of requests to the remote endpoint to check various things:
// Get remote UID
$account = user_load($node->uid);
$uid = services_client_scalar_result($client->get('uuid', 'user', array('uuid' => $account->uuid)));
// Find out if there is already an object on the master server with this UUID
$nid = services_client_scalar_result($client->get('uuid', 'node', array('uuid' => $node->uuid)));
The issue that I am faced with is if either of these return a 404 (because a user/node hasn't been created on the endpoint for eg.) an exception is thrown and halts execution.
Am I missing something major here?
To get around this I've placed some rather nasty nested try catch blocks around those calls and execution continues.
Thoughts?
Comments
Comment #1
jpstrikesback CreditAttribution: jpstrikesback commentedIn the catch block we
return FALSE;
which unnecessary halts execution right?Comment #2
mhrabovcin CreditAttribution: mhrabovcin commentedWhat services uuid module are you using? Is it one from services_client package? We made one in services_client package to return HTTP 200 with empty result rather than 404 error.
Comment #3
jpstrikesback CreditAttribution: jpstrikesback commentedOoh indeed, I'm using the uuid services module that comes with UUID (and I've refactored services clients ->get request to suit), that makes sense I guess as if a 401 comes up it is indeed a good reason to halt and sort things out.
Comment #4
mhrabovcin CreditAttribution: mhrabovcin commentedCorrect, 401 is error on which SC can't continue. Marking as closed