3
0

Add check if lambda action can be called

This commit is contained in:
Denis Arh
2020-05-26 15:48:05 +02:00
parent 2d71effdf3
commit a0c732f6ff
10 changed files with 80 additions and 40 deletions
+8 -4
View File
@@ -388,15 +388,19 @@ func (svc {{ $.Service }}) recordAction(ctx context.Context, props *{{ $.Service
// got non-{{ $.Service }} error, wrap it with {{ camelCase "" $.Service "err" "generic" }}
retError = {{ camelCase "" $.Service "err" "generic" }}(props).Wrap(err)
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// we'll use {{ camelCase "" $.Service "err" "generic" }} for recording too
// because it can hold more info
recError = retError
} else if retError != nil {
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// start with copy of return error for recording
// this will be updated with tha root cause as we try and
// unwrap the error
+8 -4
View File
@@ -349,15 +349,19 @@ func (svc accessControl) recordAction(ctx context.Context, props *accessControlA
// got non-accessControl error, wrap it with AccessControlErrGeneric
retError = AccessControlErrGeneric(props).Wrap(err)
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// we'll use AccessControlErrGeneric for recording too
// because it can hold more info
recError = retError
} else if retError != nil {
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// start with copy of return error for recording
// this will be updated with tha root cause as we try and
// unwrap the error
+8 -4
View File
@@ -725,15 +725,19 @@ func (svc application) recordAction(ctx context.Context, props *applicationActio
// got non-application error, wrap it with ApplicationErrGeneric
retError = ApplicationErrGeneric(props).Wrap(err)
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// we'll use ApplicationErrGeneric for recording too
// because it can hold more info
recError = retError
} else if retError != nil {
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// start with copy of return error for recording
// this will be updated with tha root cause as we try and
// unwrap the error
+8 -4
View File
@@ -675,15 +675,19 @@ func (svc attachment) recordAction(ctx context.Context, props *attachmentActionP
// got non-attachment error, wrap it with AttachmentErrGeneric
retError = AttachmentErrGeneric(props).Wrap(err)
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// we'll use AttachmentErrGeneric for recording too
// because it can hold more info
recError = retError
} else if retError != nil {
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// start with copy of return error for recording
// this will be updated with tha root cause as we try and
// unwrap the error
+8 -4
View File
@@ -1153,15 +1153,19 @@ func (svc auth) recordAction(ctx context.Context, props *authActionProps, action
// got non-auth error, wrap it with AuthErrGeneric
retError = AuthErrGeneric(props).Wrap(err)
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// we'll use AuthErrGeneric for recording too
// because it can hold more info
recError = retError
} else if retError != nil {
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// start with copy of return error for recording
// this will be updated with tha root cause as we try and
// unwrap the error
+8 -4
View File
@@ -621,15 +621,19 @@ func (svc reminder) recordAction(ctx context.Context, props *reminderActionProps
// got non-reminder error, wrap it with ReminderErrGeneric
retError = ReminderErrGeneric(props).Wrap(err)
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// we'll use ReminderErrGeneric for recording too
// because it can hold more info
recError = retError
} else if retError != nil {
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// start with copy of return error for recording
// this will be updated with tha root cause as we try and
// unwrap the error
+8 -4
View File
@@ -1113,15 +1113,19 @@ func (svc role) recordAction(ctx context.Context, props *roleActionProps, action
// got non-role error, wrap it with RoleErrGeneric
retError = RoleErrGeneric(props).Wrap(err)
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// we'll use RoleErrGeneric for recording too
// because it can hold more info
recError = retError
} else if retError != nil {
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// start with copy of return error for recording
// this will be updated with tha root cause as we try and
// unwrap the error
+8 -4
View File
@@ -871,15 +871,19 @@ func (svc sink) recordAction(ctx context.Context, props *sinkActionProps, action
// got non-sink error, wrap it with SinkErrGeneric
retError = SinkErrGeneric(props).Wrap(err)
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// we'll use SinkErrGeneric for recording too
// because it can hold more info
recError = retError
} else if retError != nil {
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// start with copy of return error for recording
// this will be updated with tha root cause as we try and
// unwrap the error
+8 -4
View File
@@ -322,15 +322,19 @@ func (svc statistics) recordAction(ctx context.Context, props *statisticsActionP
// got non-statistics error, wrap it with StatisticsErrGeneric
retError = StatisticsErrGeneric(props).Wrap(err)
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// we'll use StatisticsErrGeneric for recording too
// because it can hold more info
recError = retError
} else if retError != nil {
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// start with copy of return error for recording
// this will be updated with tha root cause as we try and
// unwrap the error
+8 -4
View File
@@ -1081,15 +1081,19 @@ func (svc user) recordAction(ctx context.Context, props *userActionProps, action
// got non-user error, wrap it with UserErrGeneric
retError = UserErrGeneric(props).Wrap(err)
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// we'll use UserErrGeneric for recording too
// because it can hold more info
recError = retError
} else if retError != nil {
// copy action to returning and recording error
retError.action = action().action
if action != nil {
// copy action to returning and recording error
retError.action = action().action
}
// start with copy of return error for recording
// this will be updated with tha root cause as we try and
// unwrap the error