You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have also seen such code snippets in the gin framework. Here you have done this again. Is it possible to encapsulate an IsBroken func instead of writing this every time.
Just like below:
// IsBroken check for a broken connection, as it is not really a// condition that warrants a panic stack trace.funcIsBroken(errinterface{}) bool {
ifne, ok:=err.(*net.OpError); ok {
ifse, ok:=ne.Err.(*os.SyscallError); ok {
errMsg:=strings.ToLower(se.Error())
debugPrintf("os syscall error:%s", errMsg)
ifstrings.Contains(errMsg, "broken pipe") ||strings.Contains(errMsg, "reset by peer"){
returntrue
}
}
}
returnfalse
}
The text was updated successfully, but these errors were encountered:
zap/zap.go
Line 72 in 062a8ac
I have also seen such code snippets in the gin framework. Here you have done this again. Is it possible to encapsulate an IsBroken func instead of writing this every time.
Just like below:
The text was updated successfully, but these errors were encountered: