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");