Throw error instead of returning it

This commit is contained in:
RMidhunSuresh 2022-02-02 12:25:12 +05:30
parent 7bb7189c6a
commit ac7108b882

View File

@ -48,9 +48,8 @@ export abstract class BaseRegistrationStage {
* Finish a registration stage, return value is:
* - the next stage if this stage was completed successfully
* - user-id (string) if registration is completed
* - an error if something went wrong
*/
abstract complete(auth?: Auth): Promise<BaseRegistrationStage | Error | string>;
abstract complete(auth?: Auth): Promise<BaseRegistrationStage | string>;
setNextStage(stage: BaseRegistrationStage) {
this._nextStage = stage;
@ -65,6 +64,6 @@ export abstract class BaseRegistrationStage {
return this._nextStage;
}
const error = response.error ?? "Could not parse response";
return new Error(error);
}
throw new Error(error);
}
}