Basically, I was sending a AJAX request with an object with some missing JSON data, and I was wondering why I didn't get a status code and got no response data. The JSON is valid, but there are missing data that won't allow the code to successfully run.
So I tried it several times and the request never returned any data and there was no status code as if the server didn't respond and the request timed out. I tried with a correct JSON and it worked flawlessly (I got a 200 status and a proper server response)
public function getAssets($asset_id) {
try {
$response = $this->_services[$current_service]->get_random_asset($asset_id);
} catch (Exception $e) {
throw new Exception('Something is wrong: '.$e->getMessage(), 500);
}
}
I am not sure if this is correct, but I am guessing if I don't catch the thrown Exception by putting the function call of getAssets() in a try block or any function higher in the stack the server will not send any response and the request will timeout?