From 649cd896fc43a18436d33dd312c3c6b848d9fc5e Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 16 Nov 2021 14:46:58 -0800 Subject: [PATCH] throw error and not return --- src/acme2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acme2.js b/src/acme2.js index c9fe73407..89c5b6686 100644 --- a/src/acme2.js +++ b/src/acme2.js @@ -142,7 +142,7 @@ Acme2.prototype.registerUser = async function () { const result = await this.sendSignedRequest(this.directory.newAccount, JSON.stringify(payload)); // 200 if already exists. 201 for new accounts - if (result.status !== 200 && result.status !== 201) return new BoxError(BoxError.EXTERNAL_ERROR, `Failed to register new account. Expecting 200 or 201, got ${result.status} ${JSON.stringify(result.body)}`); + if (result.status !== 200 && result.status !== 201) throw new BoxError(BoxError.EXTERNAL_ERROR, `Failed to register new account. Expecting 200 or 201, got ${result.status} ${JSON.stringify(result.body)}`); debug(`registerUser: user registered keyid: ${result.headers.location}`);