From 1d50cd86fe5e3e7a5d66a0ad4f3d042463d55bdd Mon Sep 17 00:00:00 2001 From: liamcottle Date: Wed, 29 Jun 2022 14:51:31 +1200 Subject: [PATCH] throw an exception if credentials are incorrect --- src/api.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/api.js b/src/api.js index 6a4ae28..ad49bc5 100644 --- a/src/api.js +++ b/src/api.js @@ -111,6 +111,11 @@ class API { } ); + // throw exception for auth_failure + if(access_tokens.data?.error === 'auth_failure'){ + throw new Error("auth_failure: username or password is incorrect."); + } + // update access token var tokens = parseTokensFromUrl(access_tokens.data.response.parameters.uri); this.access_token = tokens.access_token;