Skip to content

Commit

Permalink
fix(task-vis): Add more robust error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Göran Sander committed Mar 8, 2024
1 parent 766725c commit dd7feac
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 47 deletions.
1 change: 0 additions & 1 deletion src/ctrl-q.js
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,6 @@ const program = new Command();
)
.option('--qps-port <port>', 'Qlik Sense proxy service (QPS) port (usually 4243)', '4243')


.requiredOption('--auth-user-dir <directory>', 'user directory for user to connect with')
.requiredOption('--auth-user-id <userid>', 'user ID for user to connect with')

Expand Down
102 changes: 56 additions & 46 deletions src/lib/task/class_alltasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -1599,58 +1599,68 @@ class QlikSenseTasks {

let axiosConfig;
let tasks = [];
let result;

// Get reload tasks
if (filter === '') {
axiosConfig = setupQRSConnection(this.options, {
method: 'get',
fileCert: this.fileCert,
fileCertKey: this.fileCertKey,
fileCertCA: this.fileCertCA,
path: '/qrs/reloadtask/full',
});
} else {
axiosConfig = setupQRSConnection(this.options, {
method: 'get',
fileCert: this.fileCert,
fileCertKey: this.fileCertKey,
fileCertCA: this.fileCertCA,
path: '/qrs/reloadtask/full',
queryParameters: [{ name: 'filter', value: filter }],
});
}

let result = await axios.request(axiosConfig);
logger.debug(`GET RELOAD TASK: Result=result.status`);
try {
// Get reload tasks
if (filter === '') {
axiosConfig = setupQRSConnection(this.options, {
method: 'get',
fileCert: this.fileCert,
fileCertKey: this.fileCertKey,
fileCertCA: this.fileCertCA,
path: '/qrs/reloadtask/full',
});
} else {
axiosConfig = setupQRSConnection(this.options, {
method: 'get',
fileCert: this.fileCert,
fileCertKey: this.fileCertKey,
fileCertCA: this.fileCertCA,
path: '/qrs/reloadtask/full',
queryParameters: [{ name: 'filter', value: filter }],
});
}

tasks = tasks.concat(JSON.parse(result.data));
logger.verbose(`GET RELOAD TASK: # tasks: ${tasks.length}`);
result = await axios.request(axiosConfig);
logger.debug(`GET RELOAD TASK: Result=result.status`);

// Get external program tasks
if (filter === '') {
axiosConfig = setupQRSConnection(this.options, {
method: 'get',
fileCert: this.fileCert,
fileCertKey: this.fileCertKey,
fileCertCA: this.fileCertCA,
path: '/qrs/externalprogramtask/full',
});
} else {
axiosConfig = setupQRSConnection(this.options, {
method: 'get',
fileCert: this.fileCert,
fileCertKey: this.fileCertKey,
fileCertCA: this.fileCertCA,
path: '/qrs/externalprogramtask/full',
queryParameters: [{ name: 'filter', value: filter }],
});
tasks = tasks.concat(JSON.parse(result.data));
logger.verbose(`GET RELOAD TASK: # tasks: ${tasks.length}`);
} catch (err) {
catchLog('GET TASKS FROM QSEOW 1', err);
reject(err);
}
try {
// Get external program tasks
if (filter === '') {
axiosConfig = setupQRSConnection(this.options, {
method: 'get',
fileCert: this.fileCert,
fileCertKey: this.fileCertKey,
fileCertCA: this.fileCertCA,
path: '/qrs/externalprogramtask/full',
});
} else {
axiosConfig = setupQRSConnection(this.options, {
method: 'get',
fileCert: this.fileCert,
fileCertKey: this.fileCertKey,
fileCertCA: this.fileCertCA,
path: '/qrs/externalprogramtask/full',
queryParameters: [{ name: 'filter', value: filter }],
});
}

result = await axios.request(axiosConfig);
logger.debug(`GET EXT PROGRAM TASK: Result=result.status`);
result = await axios.request(axiosConfig);
logger.debug(`GET EXT PROGRAM TASK: Result=result.status`);

tasks = tasks.concat(JSON.parse(result.data));
logger.verbose(`GET EXT PROGRAM TASK: # tasks: ${tasks.length}`);
tasks = tasks.concat(JSON.parse(result.data));
logger.verbose(`GET EXT PROGRAM TASK: # tasks: ${tasks.length}`);
} catch (err) {
catchLog('GET EXTERNAL PROGRAM TASKS FROM QSEOW 1', err);
reject(err);
}

// TODO
// Determine whether task name anonymisation should be done
Expand Down

0 comments on commit dd7feac

Please sign in to comment.