From 709c4646cafb0f4578938e4ff59251d53ed3331d Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Sun, 10 Jun 2018 21:02:27 +0200 Subject: [PATCH] Adding wrong credentials error message --- index.js | 2 ++ index.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/index.js b/index.js index d197811..3c50fbb 100644 --- a/index.js +++ b/index.js @@ -85,6 +85,8 @@ var SecureFile = /** @class */ (function () { //TODO probably better fail check throw new NoConnection(); case 4: + if (code_res.status == 403) + throw new Error("Unauthorized"); statusParser(code_res); return [4 /*yield*/, code_res.json()]; case 5: diff --git a/index.ts b/index.ts index 6c5590c..702773a 100644 --- a/index.ts +++ b/index.ts @@ -47,6 +47,7 @@ export default class SecureFile { //TODO probably better fail check throw new NoConnection(); } + if (code_res.status == 403) throw new Error("Unauthorized"); statusParser(code_res); let code = (await code_res.json()).code; let r = new rsa(this.PrivateKey, "pkcs1-pem");