Improve errorhandling in netcup dns

This commit is contained in:
Johannes Zellner
2022-02-14 10:57:06 +01:00
parent de84cbc977
commit ac57e433b1

View File

@@ -53,6 +53,7 @@ async function login(domainConfig) {
const [error, response] = await safe(superagent.post(API_ENDPOINT).send(data).ok(() => true));
if (error) throw new BoxError(BoxError.NETWORK_ERROR, error.message);
if (response.statusCode !== 200) throw new BoxError(BoxError.EXTERNAL_ERROR, formatError(response));
if (!response.body.responsedata.apisessionid) throw new BoxError(BoxError.ACCESS_DENIED, 'invalid api password');
return response.body.responsedata.apisessionid;
}