From 094983ad47838b2e2067f872186c0851a43aec44 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 11 Sep 2020 09:55:55 +0300 Subject: [PATCH] Show the server error on failure to create account --- src/MigrateV2.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/MigrateV2.tsx b/src/MigrateV2.tsx index 775b9a5..a5dfbc3 100644 --- a/src/MigrateV2.tsx +++ b/src/MigrateV2.tsx @@ -173,7 +173,12 @@ export function WizardAccountPage(props: OurPagePropsType & { setEtebase: (eteba headers: { Authorization: "Token " + props.etesync.credentials.authToken }, }); if (!response.ok) { - throw new Error("Failed preparing account for migration"); + try { + const json = await response.json(); + throw new Error(json.detail ?? JSON.stringify(json)); + } catch (e) { + throw new Error("Failed preparing account for migration"); + } } }