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 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) + } +}