Skip to content

Commit 446ca3a

Browse files
authored
Merge pull request #660 from Travelport-Ukraine/master
0.17.1 Hotfix for `uapiErrorHandler`
2 parents 126057f + a491a0e commit 446ca3a

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

docs/Terminal.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@ on how to use emulation.
2626
In case you want to handle some specific errors from uAPI, you can provde `uapiErrorHandler` function
2727
in options.
2828

29+
Function should return response from retried command or any other command.
30+
2931
Footprint of the functions should be as follows:
3032
```javascript
3133
async (
3234
executeCommandWithRetry,
3335
{ command, error: err }
3436
) => {
3537
// your code goes here
38+
// response is an array of strings (lines of terminal response)
39+
return response;
3640
}
3741
```
3842

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "uapi-json",
3-
"version": "1.17.0",
3+
"version": "1.17.1",
44
"description": "Travelport Universal API",
55
"main": "src/",
66
"files": [

src/Services/Terminal/Terminal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ module.exports = function (settings) {
170170
} catch (e) {
171171
if (!isErrorRetriable(e) || times <= 0) {
172172
if (uapiErrorHandler) {
173-
await uapiErrorHandler(
173+
return uapiErrorHandler(
174174
executeCommandWithRetry,
175175
{ command, error: e }
176176
);

test/Terminal/Terminal.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,14 @@ describe('#Terminal', function terminalTest() {
313313
});
314314
});
315315
});
316-
describe('Handling uapi errors', () => {
316+
describe.only('Handling uapi errors', () => {
317317
beforeEach(() => {
318318
// Resetting spies
319319
getSessionToken.resetHistory();
320320
executeCommandOk.resetHistory();
321321
closeSession.resetHistory();
322+
erIssues.resetHistory();
323+
executeCommandErIssues.resetHistory();
322324
});
323325
it('should fail if no handlers provided', async () => {
324326
const uAPITerminal = terminalErIssues({
@@ -354,7 +356,7 @@ describe('#Terminal', function terminalTest() {
354356
faultstring: 'String index out of range: 6',
355357
});
356358

357-
await executeCommandWithRetry(command, 0);
359+
return executeCommandWithRetry(command, 0);
358360
},
359361
}
360362
});

0 commit comments

Comments
 (0)