File: request-errors.go

package info (click to toggle)
golang-github-pkg-sftp 1.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 476 kB
  • sloc: makefile: 6
file content (42 lines) | stat: -rw-r--r-- 1,192 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package sftp

// Error types that match the SFTP's SSH_FXP_STATUS codes. Gives you more
// direct control of the errors being sent vs. letting the library work them
// out from the standard os/io errors.

type fxerr uint32

const (
	ErrSshFxOk               = fxerr(ssh_FX_OK)
	ErrSshFxEof              = fxerr(ssh_FX_EOF)
	ErrSshFxNoSuchFile       = fxerr(ssh_FX_NO_SUCH_FILE)
	ErrSshFxPermissionDenied = fxerr(ssh_FX_PERMISSION_DENIED)
	ErrSshFxFailure          = fxerr(ssh_FX_FAILURE)
	ErrSshFxBadMessage       = fxerr(ssh_FX_BAD_MESSAGE)
	ErrSshFxNoConnection     = fxerr(ssh_FX_NO_CONNECTION)
	ErrSshFxConnectionLost   = fxerr(ssh_FX_CONNECTION_LOST)
	ErrSshFxOpUnsupported    = fxerr(ssh_FX_OP_UNSUPPORTED)
)

func (e fxerr) Error() string {
	switch e {
	case ErrSshFxOk:
		return "OK"
	case ErrSshFxEof:
		return "EOF"
	case ErrSshFxNoSuchFile:
		return "No Such File"
	case ErrSshFxPermissionDenied:
		return "Permission Denied"
	case ErrSshFxBadMessage:
		return "Bad Message"
	case ErrSshFxNoConnection:
		return "No Connection"
	case ErrSshFxConnectionLost:
		return "Connection Lost"
	case ErrSshFxOpUnsupported:
		return "Operation Unsupported"
	default:
		return "Failure"
	}
}