Skip to content

Commit 1f4904b

Browse files
author
Owen Strain
authored
Make it possible to implement FuncError from other packages (#1487)
1 parent 6559b2c commit 1f4904b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

api/models/error.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,8 @@ func GetAPIErrorCode(e error) int {
245245
// APIError but distinguishes fault to function specific errors
246246
type FuncError interface {
247247
APIError
248-
249-
// hidden method needed for duck typing
250-
userError()
248+
// no-op method (needed to make the interface unique)
249+
ImplementsFuncError()
251250
}
252251

253252
type ferr struct {
@@ -258,8 +257,8 @@ type ferr struct {
258257
var _ FuncError = ferr{}
259258
var _ APIError = ferr{}
260259

261-
func (e ferr) userError() {}
262-
func (e ferr) Code() int { return e.code }
260+
func (e ferr) ImplementsFuncError() {}
261+
func (e ferr) Code() int { return e.code }
263262

264263
// NewFuncError returns a FuncError
265264
func NewFuncError(err APIError) error { return ferr{code: err.Code(), error: err} }

0 commit comments

Comments
 (0)