code: func ErrorCode(err error) int {
  	switch t := err.(type) {
  	case Error:
  		return int(t)
  	case *os.PathError:
  		if errno, ok := t.Err.(syscall.Errno); ok {
  			switch errno {
  			case syscall.ENOTEMPTY:
  				return DirectoryNotEmpty
  			}
  		}
  	case *exec.Error:
  		if t.Err == exec.ErrNotFound {
  			return FileNotFound
  		}
  	}
  
  	switch {
  	case os.IsNotExist(err):
  		return FileNotFound
  	case os.IsExist(err):
  		return FileAlreadyExists
  	case os.IsPermission(err):
  		return FileAccessError
  	default:
  		return Fail
  	}
  }
docs: // ErrorCode does its best to map the given error to a VIX error code.
  // See also: Vix_TranslateErrno