From e79089b880f616c11c17bd0e190688ead4dcb8fd Mon Sep 17 00:00:00 2001 From: Krishna Acondy Date: Fri, 28 May 2021 08:52:00 +0100 Subject: [PATCH 1/2] fix(sas9-support): throw error with invalid credentials --- src/request/RequestClient.ts | 5 +++++ src/types/errors/SAS9AuthError.ts | 9 +++++++++ 2 files changed, 14 insertions(+) create mode 100644 src/types/errors/SAS9AuthError.ts diff --git a/src/request/RequestClient.ts b/src/request/RequestClient.ts index 991b7a3..62a144e 100644 --- a/src/request/RequestClient.ts +++ b/src/request/RequestClient.ts @@ -10,6 +10,7 @@ import { } from '../types/errors' import { parseWeboutResponse } from '../utils/parseWeboutResponse' import { prefixMessage } from '@sasjs/utils/error' +import { SAS9AuthError } from '../types/errors/SAS9AuthError' export interface HttpClient { get( @@ -470,6 +471,10 @@ export const throwIfError = (response: AxiosResponse) => { throw new AuthorizeError(response.data.message, authorizeRequestUrl) } + if (response.config?.url?.includes('sasAuthError')) { + throw new SAS9AuthError() + } + const error = parseError(response.data as string) if (error) { diff --git a/src/types/errors/SAS9AuthError.ts b/src/types/errors/SAS9AuthError.ts new file mode 100644 index 0000000..2e3ad00 --- /dev/null +++ b/src/types/errors/SAS9AuthError.ts @@ -0,0 +1,9 @@ +export class SAS9AuthError extends Error { + constructor() { + super( + 'The credentials you provided cannot be authenticated. Please provide a valid set of credentials.' + ) + this.name = 'AuthorizeError' + Object.setPrototypeOf(this, SAS9AuthError.prototype) + } +} From b247da249ab4d3fc973617ffec4bbbbd406a5baf Mon Sep 17 00:00:00 2001 From: Krishna Acondy Date: Fri, 28 May 2021 08:52:18 +0100 Subject: [PATCH 2/2] chore(git-hooks): allow numbers in commit message --- .git-hooks/commit-msg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.git-hooks/commit-msg b/.git-hooks/commit-msg index e0297de..d12ec2f 100755 --- a/.git-hooks/commit-msg +++ b/.git-hooks/commit-msg @@ -6,7 +6,7 @@ GREEN="\033[1;32m" # temporary file which holds the message). commit_message=$(cat "$1") -if (echo "$commit_message" | grep -Eq "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z \-]+\))?!?: .+$") then +if (echo "$commit_message" | grep -Eq "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z0-9 \-]+\))?!?: .+$") then echo "${GREEN} ✔ Commit message meets Conventional Commit standards" exit 0 fi