Skip to content

Commit

Permalink
perf: Add error logging to response function
Browse files Browse the repository at this point in the history
  • Loading branch information
AxiosLeo committed Feb 6, 2024
1 parent 7d746f6 commit aae7ee8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/workflow.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

const os = require('os');
const { debug, printer } = require('@axiosleo/cli-tool');
const Validator = require('validatorjs');
const is = require('@axiosleo/cli-tool/src/helper/is');
Expand Down Expand Up @@ -166,8 +167,16 @@ async function response(context) {
context.response = response;
if (context.app.config.debug) {
printer.yellow('[DEBUG] ');
if (context.response.data) {
debug.log('response', context.response.data);
if (context.response.stack) {
let tmp = context.response.stack.split(os.EOL);
if (tmp[3]) {
let t = tmp[3].trim();
if (t.startsWith('at /')) {
printer.print('response '.data).print(tmp[3].trim().warning).println();
}
}
// eslint-disable-next-line no-console
console.log(context.response.data);
} else {
debug.log('response', context.response);
}
Expand Down

0 comments on commit aae7ee8

Please sign in to comment.