Skip to content

Commit

Permalink
bug-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rozturac committed Jan 12, 2022
1 parent f65db5e commit 6cb7cfb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ func getErrorCode() string {
frames := runtime.CallersFrames(rpc)
frame, _ := frames.Next()
if frame.Func != nil && strings.Contains(frame.Function, "Error") {
return strings.Split(frame.Function, ".")[2]
list := strings.Split(frame.Function, ".")
return list[len(list)-1]
} else {
return "CustomError"
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/rozturac/cerror

go 1.16

require github.com/labstack/echo/v4 v4.6.1 // indirect
require github.com/labstack/echo/v4 v4.6.1

0 comments on commit 6cb7cfb

Please sign in to comment.