up
This commit is contained in:
+4
-1
@@ -530,8 +530,11 @@ if (empty($user_id)) {
|
||||
}
|
||||
return JSON.parse(text);
|
||||
} catch (err) {
|
||||
// Incluir parte del cuerpo en el error para ayudar al diagnóstico (truncado)
|
||||
console.error('apiCall parse error for', url, err);
|
||||
throw new Error('Invalid JSON response from ' + url + ': ' + err.message);
|
||||
const respText = await response.text().catch(() => '');
|
||||
const snippet = (respText && respText.length > 0) ? respText.substr(0, 1000) : '<no body available>';
|
||||
throw new Error('Invalid JSON response from ' + url + ': ' + err.message + ' -- response snippet: ' + snippet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user