refactor mw example
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package usecasehelper
|
||||
|
||||
type MWType string
|
||||
|
||||
const (
|
||||
MWTPre MWType = "Pre"
|
||||
MWTPost MWType = "Post"
|
||||
)
|
||||
@@ -3,6 +3,7 @@ package usecasehelper
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
pl "simrs-vx/pkg/logger"
|
||||
|
||||
@@ -46,3 +47,10 @@ func HandleReadError(err error, event *pl.Event, itemType string, id interface{}
|
||||
|
||||
return pl.SetLogError(*event, nil)
|
||||
}
|
||||
|
||||
func GetMiddlewareErrorCode(mwType MWType) string {
|
||||
if strings.Contains(string(mwType), "Pre") {
|
||||
return "MW_PRE_FAILED"
|
||||
}
|
||||
return "MW_POST_FAILED"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user