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

Move exception throw into _chooseFlow

This commit is contained in:
David Baker
2017-03-15 14:33:31 +00:00
parent 7777cbf6da
commit c9c3937f4b

View File

@@ -334,15 +334,6 @@ InteractiveAuth.prototype = {
*/ */
_chooseStage: function() { _chooseStage: function() {
const flow = this._chooseFlow(); const flow = this._chooseFlow();
if (!flow) {
// XXX: This happens to be the only way this can fail right now, but
// 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",
);
}
console.log("Active flow => %s", JSON.stringify(flow)); console.log("Active flow => %s", JSON.stringify(flow));
const nextStage = this._firstUncompletedStage(flow); const nextStage = this._firstUncompletedStage(flow);
console.log("Next stage: %s", nextStage); console.log("Next stage: %s", nextStage);
@@ -388,7 +379,13 @@ InteractiveAuth.prototype = {
return flow; return flow;
} }
} }
return null; // XXX: This happens to be the only way this can fail right now, but
// 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",
);
}, },
/** /**