diff options
author | Valery Piashchynski <[email protected]> | 2020-08-27 22:38:46 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-08-27 22:38:46 +0300 |
commit | f6e5e0e4801109f0b53b9f637fbf9d3949979a96 (patch) | |
tree | 42385a9fbdf242264ff20efaa2d920cc9a7436ac /service/http/errors.go | |
parent | 50d12dcb0649836db1ac8670720fa0112c430b1e (diff) |
Update error handler
Diffstat (limited to 'service/http/errors.go')
-rw-r--r-- | service/http/errors.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/service/http/errors.go b/service/http/errors.go new file mode 100644 index 00000000..bdf10332 --- /dev/null +++ b/service/http/errors.go @@ -0,0 +1,24 @@ +// +build !windows + +package http + +import ( + "errors" + "net" + "os" + "syscall" +) + +var errEPIPE = errors.New("EPIPE(32) -> connection reset by peer") + +// handleWriteError just check if error was caused by aborted connection on linux +func handleWriteError(err error) error { + if netErr, ok2 := err.(*net.OpError); ok2 { + if syscallErr, ok3 := netErr.Err.(*os.SyscallError); ok3 { + if syscallErr.Err == syscall.EPIPE { + return errEPIPE + } + } + } + return err +} |