1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Do no-auth-flow error handling more properly

This commit is contained in:
David Baker
2017-03-15 16:42:57 +00:00
parent c9c3937f4b
commit 6c2e8eba1c

View File

@@ -383,9 +383,12 @@ InteractiveAuth.prototype = {
// in general this is not really going to be an accurate error message.
// Ideally this would signal what inputs could be removed such that a matching
// flow could be found.
throw new Error(
"This server does not support registration with a phone number",
);
const err = new Error("No appropriate authentication flow found");
err.required_stages = [];
if (haveEmail) err.required_stages.push(EMAIL_STAGE_TYPE);
if (haveMsisdn) err.required_stages.push(MSISDN_STAGE_TYPE);
err.available_flows = flows;
throw err;
},
/**