Skip to content

Commit

Permalink
fix: 优化云函数调用返回结构;
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Jun 21, 2021
1 parent f379369 commit ea8e4a1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/router/function/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ async function handleInvokeFunction(req: Request, res: Response) {
// 调用出错
if (result.error) {
logger.info(`[${requestId}] /func/${func_name} invoke error: `, result.error.message)
logger.trace(`[${requestId}] /func/${func_name} invoke error: `, result)
return res.send({
code: 1,
logger.error(`[${requestId}] /func/${func_name} invoke error: `, result)
return res.status(400).send({
error: 'invoke function occurs error',
logs: debug ? result.logs : undefined,
time_usage: debug ? result.time_usage : undefined,
Expand All @@ -105,7 +104,6 @@ async function handleInvokeFunction(req: Request, res: Response) {

// 调用成功返回
return res.send({
code: 0,
requestId,
data: result.data,
time_usage: debug ? result.time_usage : undefined,
Expand Down

0 comments on commit ea8e4a1

Please sign in to comment.