fix(plugin-workflow-request): fix response log (#4249)

This commit is contained in:
Junyi 2024-05-01 13:28:22 +08:00 committed by GitHub
parent 9ca4b4584c
commit 45d9eca38b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -84,15 +84,20 @@ export default class extends Instruction {
status: JOB_STATUS.RESOLVED,
result: response.data,
});
processor.logger.info(`request (#${node.id}) response success, status: ${response.status}`);
})
.catch((error) => {
job.set({
status: JOB_STATUS.FAILED,
result: error.isAxiosError ? error.toJSON() : error.message,
});
if (error.response) {
processor.logger.info(`request (#${node.id}) response failed, status: ${error.response.status}`);
} else {
processor.logger.error(`request (#${node.id}) response failed: ${error.message}`);
}
})
.finally(() => {
processor.logger.info(`request (#${node.id}) response received, status: ${job.get('status')}`);
this.workflow.resume(job);
});