refactor: expose online backup deletion outcome
This commit is contained in:
@@ -235,9 +235,9 @@ async function deleteOnlineBackup(key, baseUrl = ONLINE_BACKUP_API_URL, options)
|
||||
headers: { 'content-type': 'application/json', accept: 'application/json' },
|
||||
body: JSON.stringify({ id: parsed.id, deleteSecret })
|
||||
}, options);
|
||||
if (response.status !== 204) {
|
||||
throw new Error(response.status === 404 ? 'Online-Sicherung wurde nicht gefunden' : 'Online-Sicherung konnte nicht gelöscht werden');
|
||||
}
|
||||
if (response.status === 204) return { deleted: true, notFound: false };
|
||||
if (response.status === 404) return { deleted: false, notFound: true };
|
||||
throw new Error('Online-Sicherung konnte nicht gelöscht werden');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user