github.com/x04/go/src@v0.0.0-20200202162449-3d481ceb3525/os/error_posix.go (about)

     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  // +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
     6  
     7  package os
     8  
     9  import "github.com/x04/go/src/syscall"
    10  
    11  // wrapSyscallError takes an error and a syscall name. If the error is
    12  // a syscall.Errno, it wraps it in a os.SyscallError using the syscall name.
    13  func wrapSyscallError(name string, err error) error {
    14  	if _, ok := err.(syscall.Errno); ok {
    15  		err = NewSyscallError(name, err)
    16  	}
    17  	return err
    18  }