Show the server error on failure to create account

master
Tom Hacohen 4 years ago
parent 71c1ebc213
commit 094983ad47

@ -173,9 +173,14 @@ export function WizardAccountPage(props: OurPagePropsType & { setEtebase: (eteba
headers: { Authorization: "Token " + props.etesync.credentials.authToken }, headers: { Authorization: "Token " + props.etesync.credentials.authToken },
}); });
if (!response.ok) { if (!response.ok) {
try {
const json = await response.json();
throw new Error(json.detail ?? JSON.stringify(json));
} catch (e) {
throw new Error("Failed preparing account for migration"); throw new Error("Failed preparing account for migration");
} }
} }
}
etebase = await Etebase.Account.signup(user, password, serverUrl); etebase = await Etebase.Account.signup(user, password, serverUrl);
} }

Loading…
Cancel
Save