From ac7108b882d8a3ac19093f83a6c498e742d5bda2 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Wed, 2 Feb 2022 12:25:12 +0530 Subject: [PATCH] Throw error instead of returning it --- src/matrix/registration/stages/BaseRegistrationStage.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/matrix/registration/stages/BaseRegistrationStage.ts b/src/matrix/registration/stages/BaseRegistrationStage.ts index 6ffd9187..df23c429 100644 --- a/src/matrix/registration/stages/BaseRegistrationStage.ts +++ b/src/matrix/registration/stages/BaseRegistrationStage.ts @@ -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; + abstract complete(auth?: Auth): Promise; 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); + } }