Skip to content

Commit

Permalink
feat(Session): Describe error 100005 as Request format error
Browse files Browse the repository at this point in the history
  • Loading branch information
Salamek committed Dec 29, 2021
1 parent ddc4170 commit d44950c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
ResponseErrorLoginRequiredException,
ResponseErrorNotSupportedException,
ResponseErrorSystemBusyException,
ResponseErrorLoginCsrfException
ResponseErrorLoginCsrfException,
RequestFormatException
} from './exceptions';


Expand Down Expand Up @@ -120,15 +121,17 @@ export class Connection {
[ResponseCodeEnum.ERROR_SYSTEM_NO_RIGHTS]: 'No rights (needs login)',
[ResponseCodeEnum.ERROR_SYSTEM_NO_SUPPORT]: 'No support',
[ResponseCodeEnum.ERROR_SYSTEM_UNKNOWN]: 'Unknown',
[ResponseCodeEnum.ERROR_SYSTEM_CSRF]: 'Session error'
[ResponseCodeEnum.ERROR_SYSTEM_CSRF]: 'Session error',
[ResponseCodeEnum.ERROR_FORMAT_ERROR]: 'Request format error',
}

const errorCodeToException: { [key in keyof typeof ResponseCodeEnum]?: typeof ResponseErrorException } = {
[ResponseCodeEnum.ERROR_SYSTEM_BUSY]: ResponseErrorSystemBusyException,
[ResponseCodeEnum.ERROR_SYSTEM_NO_RIGHTS]: ResponseErrorLoginRequiredException,
[ResponseCodeEnum.ERROR_SYSTEM_NO_SUPPORT]: ResponseErrorNotSupportedException,
[ResponseCodeEnum.ERROR_SYSTEM_UNKNOWN]: ResponseErrorException,
[ResponseCodeEnum.ERROR_SYSTEM_CSRF]: ResponseErrorLoginCsrfException
[ResponseCodeEnum.ERROR_SYSTEM_CSRF]: ResponseErrorLoginCsrfException,
[ResponseCodeEnum.ERROR_FORMAT_ERROR]: RequestFormatException,
}

if ('error' in data) {
Expand Down
1 change: 1 addition & 0 deletions src/enums/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ export enum ResponseCodeEnum {
ERROR_SYSTEM_NO_SUPPORT = 100002,
ERROR_SYSTEM_NO_RIGHTS = 100003,
ERROR_SYSTEM_BUSY = 100004,
ERROR_FORMAT_ERROR = 100005,
ERROR_SYSTEM_CSRF = 125002
}
3 changes: 3 additions & 0 deletions src/exceptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ export class LoginErrorUsernamePasswordOverrunException extends ResponseErrorExc


export class LoginErrorUsernamePasswordModifyException extends ResponseErrorException { }


export class RequestFormatException extends ResponseErrorException { }

0 comments on commit d44950c

Please sign in to comment.