Merge pull request #3889 from alphagov/webauthn-errors

Handle errors when registration fails
This commit is contained in:
Ben Thorner
2021-05-19 11:22:05 +01:00
committed by GitHub
8 changed files with 152 additions and 64 deletions

View File

@@ -27,7 +27,16 @@
})
.then((response) => {
if (!response.ok) {
throw Error(response.statusText);
return response.arrayBuffer()
.then((cbor) => {
return Promise.resolve(window.CBOR.decode(cbor));
})
.catch(() => {
throw Error(response.statusText);
})
.then((text) => {
throw Error(text);
});
}
window.location.reload();