Skip to content

Commit 15bad94

Browse files
committed
throw exception for max depth error
1 parent 1e6a504 commit 15bad94

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"max-depth": 10,
2+
"max-depth": 50,
33
"current-depth": 0,
44
"error-rate": 0.05
55
}

sample-apps/error-processor/random-error/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ var myFunction = async function(event, context) {
2323
subsegment.addAnnotation('roll2', roll2)
2424
subsegment.addAnnotation('request_id', context.awsRequestId)
2525
})
26-
2726

2827
event["current-depth"] += 1
2928
if (event["max-depth"] == event["current-depth"]) {
@@ -47,6 +46,13 @@ var myFunction = async function(event, context) {
4746
else {
4847
response.depth +=1
4948
}
49+
if ( response.errorType == "function.MaxDepthError" ){
50+
var error = new Error(response.errorMessage)
51+
error.name = "function.MaxDepthError"
52+
console.log("ERROR")
53+
throw error
54+
}
55+
5056
return response
5157
}
5258

0 commit comments

Comments
 (0)