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年前