fix: throw errors on request failure

This commit is contained in:
Peter Evans 2020-10-27 10:41:21 +09:00
parent dac62d382a
commit 8dd2813668
2 changed files with 8 additions and 0 deletions

4
dist/index.js vendored
View file

@ -72,6 +72,10 @@ function updateRepositoryDescription(token, repository, description, fullDescrip
'Content-Type': 'application/json',
Authorization: `JWT ${token}`
}
}).then(res => {
if (!res.ok) {
throw new Error(res.statusText);
}
});
});
}

View file

@ -40,5 +40,9 @@ export async function updateRepositoryDescription(
'Content-Type': 'application/json',
Authorization: `JWT ${token}`
}
}).then(res => {
if (!res.ok) {
throw new Error(res.statusText)
}
})
}