Improve errorhandling in netcup dns
This commit is contained in:
@@ -53,6 +53,7 @@ async function login(domainConfig) {
|
|||||||
const [error, response] = await safe(superagent.post(API_ENDPOINT).send(data).ok(() => true));
|
const [error, response] = await safe(superagent.post(API_ENDPOINT).send(data).ok(() => true));
|
||||||
if (error) throw new BoxError(BoxError.NETWORK_ERROR, error.message);
|
if (error) throw new BoxError(BoxError.NETWORK_ERROR, error.message);
|
||||||
if (response.statusCode !== 200) throw new BoxError(BoxError.EXTERNAL_ERROR, formatError(response));
|
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;
|
return response.body.responsedata.apisessionid;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user