Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
response => {
const responseBody = response.data;
if (!responseBody || !responseBody.results) {
return rejectWith(fumble.create(), {
name,
formattedUrl,
reason: "no result"
});
}
const { results } = responseBody;
if (results.error) {
const { code, message } = results.error;
return rejectWith(fumble.create(code, message), { name, formattedUrl });
}
return results;
},
error => rejectWith(fumble.create(), { name, formattedUrl, reason: error.message })
response => {
const responseBody = response.data;
if (!responseBody || !responseBody.results) {
return rejectWith(fumble.create(), {
name,
formattedUrl,
reason: "no result"
});
}
const { results } = responseBody;
if (results.error) {
const { code, message } = results.error;
return rejectWith(fumble.create(code, message), { name, formattedUrl });
}
return results;
},
error => rejectWith(fumble.create(), { name, formattedUrl, reason: error.message })
error => rejectWith(fumble.create(), { name, formattedUrl, reason: error.message })
);