diff --git a/src/MigrateV2.tsx b/src/MigrateV2.tsx index a5dfbc3..ac55c6c 100644 --- a/src/MigrateV2.tsx +++ b/src/MigrateV2.tsx @@ -188,7 +188,24 @@ export function WizardAccountPage(props: OurPagePropsType & { setEtebase: (eteba props.next?.(); setProgress("Done"); } catch (e) { - if (e instanceof Etebase.UnauthorizedError) { + if ((e instanceof Etebase.HttpError) && (e.content)) { + let found = false; + if (e.content.errors) { + for (const field of e.content.errors) { + if (field.field === "user.username") { + errors.errorEmail = field.detail; + found = true; + } else if (!field.field) { + errors.errorGeneral = field.detail; + found = true; + } + } + } + + if (!found) { + errors.errorGeneral = e.content.detail ?? e.toString(); + } + } else if (e instanceof Etebase.UnauthorizedError) { errors.errorGeneral = "Wrong username or password"; } else { errors.errorGeneral = e.toString();