-
Notifications
You must be signed in to change notification settings - Fork 6
🐛 IE-139 Fix V1 compatibility when failOnErrorStatusCode flag is False #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/client/baseClient.ts
Outdated
| response: Response | ||
| ): Response { | ||
| if ( | ||
| [400, 401, 403, 404, 405, 408, 429, 500, 502, 504, 901].includes( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the codes from here: https://developers.liveperson.com/liveperson-functions-foundations-error-codes.html#error-codes , Can be that not in all returns the error "code-message" format, but it wont hurt since we check here isV2ErrorBody() the type
src/client/baseClient.ts
Outdated
| return domain.includes('fninvocations') || domain.includes('functions'); | ||
| } | ||
|
|
||
| private transfornReponseErrorForV1Compatibility( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| private transfornReponseErrorForV1Compatibility( | |
| private transformReponseErrorForV1Compatibility( |
src/client/baseClient.ts
Outdated
| private transfornReponseErrorForV1Compatibility( | ||
| response: Response | ||
| ): Response { | ||
| if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest this feels unnecessary complicated and leaves room for errors. Probably the easiest is to check if the body has properties code + message and is a non successful call and then you can map it.
This we you can also make a fast exit for success responses.
.github/workflows/unit-test.yml
Outdated
| # run on all supported LTS versions and the latest/current version | ||
| node-version: [14, 16, 18, latest] | ||
| # run on all supported LTS versions and the latest lts version | ||
| node-version: [14, 16, 18, 22, 'lts/*'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are versions included that are no longer officially supported. Hence we should reduce either to 18, 22, lts or 22 & lts
| node-version: [14, 16, 18, 22, 'lts/*'] | |
| node-version: [18, 22, 'lts/*'] |
| }); | ||
| } | ||
| }); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a test case that shows that a response (success) with code & message would not be adjusted. Highlighting the behaviour that we don't interfere with successful customer responses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New test added L166

No description provided.