1 個回答
- 最新
- 最多得票
- 最多評論
0
Hi!
From the docs:
$util.appendError(String).
Appends a custom error. This can be used in request or response mapping templates if the template detects an error with the request or with the invocation result. Unlike $util.error(String), the template evaluation will not be interrupted, so that data can be returned to the caller.
In your case the else statement isn't actually returning a response, i think your response mapping template should use $utils.error helper instead:
#if($ctx.error) $util.error($ctx.error.message, $ctx.error.type) #end
#if($ctx.result.statusCode == 200) #set($body = $util.parseJson($ctx.result.body))
$util.toJson($body) #else $utils.error($ctx.result.body, $ctx.result.statusCode) #end
已回答 2 年前
相關內容
- AWS 官方已更新 2 年前
- AWS 官方已更新 2 年前
- AWS 官方已更新 10 個月前
- AWS 官方已更新 1 年前