Skip to content

Commit a7ce869

Browse files
committed
Follow new fail API
1 parent 7e9c8c9 commit a7ce869

File tree

4 files changed

+163
-336
lines changed

4 files changed

+163
-336
lines changed

handlers.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ func WithReportableErrorHandler(f FailHandlerFunc) interface {
8686
StreamServerErrorHandler
8787
} {
8888
return WithFailHandler(func(c context.Context, err *fail.Error) error {
89-
if err.Report {
90-
return f(c, err)
89+
if err.Ignorable {
90+
return err
9191
}
92-
return err
92+
return f(c, err)
9393
})
9494
}
9595

@@ -102,7 +102,7 @@ func WithStatusCodeMap(m CodeMap) interface {
102102
StreamServerErrorHandler
103103
} {
104104
return WithFailHandler(func(c context.Context, err *fail.Error) error {
105-
if c, ok := m[err.StatusCode]; ok {
105+
if c, ok := m[err.Code]; ok {
106106
return status.Error(c, err.Error())
107107
}
108108
return err
@@ -118,7 +118,7 @@ func WithStatusCodeMapper(mapFn CodeMapFunc) interface {
118118
StreamServerErrorHandler
119119
} {
120120
return WithFailHandler(func(c context.Context, err *fail.Error) error {
121-
return status.Error(mapFn(err.StatusCode), err.Error())
121+
return status.Error(mapFn(err.Code), err.Error())
122122
})
123123
}
124124

0 commit comments

Comments
 (0)