Source file src/net/error_posix.go
1 // Copyright 2017 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build unix || js || wasip1 || windows 6 7 package net 8 9 import ( 10 "os" 11 "syscall" 12 ) 13 14 // wrapSyscallError takes an error and a syscall name. If the error is 15 // a syscall.Errno, it wraps it in an os.SyscallError using the syscall name. 16 func wrapSyscallError(name string, err error) error { 17 if _, ok := err.(syscall.Errno); ok { 18 err = os.NewSyscallError(name, err) 19 } 20 return err 21 } 22