Merge pull request #23 from peter-evans/fix-error-handling

fix: throw errors on request failure
This commit is contained in:
Peter Evans 2020-10-27 10:44:08 +09:00 committed by GitHub
commit 1d0dd5623c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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)
}
})
}