cloudflare: fix crash when result is null

This commit is contained in:
Girish Ramakrishnan
2024-04-01 17:31:05 +02:00
parent 1c4f6315a6
commit d862f1f5b4

View File

@@ -102,7 +102,9 @@ async function getDnsRecords(domainConfig, zoneId, fqdn, type) {
if (error) throw new BoxError(BoxError.NETWORK_ERROR, error.message);
if (response.statusCode !== 200 || response.body.success !== true) throw translateRequestError(response);
return response.body.result;
const result = response.body.result;
if (!Array.isArray(result)) throw new BoxError(BoxError.EXTERNAL_ERROR, `result is not an array when getting records: ${response.statusCode} ${response.text}`);
return result;
}
async function upsert(domainObject, location, type, values) {