1package sftp 2 3type fxerr uint32 4 5// Error types that match the SFTP's SSH_FXP_STATUS codes. Gives you more 6// direct control of the errors being sent vs. letting the library work them 7// out from the standard os/io errors. 8const ( 9 ErrSSHFxOk = fxerr(sshFxOk) 10 ErrSSHFxEOF = fxerr(sshFxEOF) 11 ErrSSHFxNoSuchFile = fxerr(sshFxNoSuchFile) 12 ErrSSHFxPermissionDenied = fxerr(sshFxPermissionDenied) 13 ErrSSHFxFailure = fxerr(sshFxFailure) 14 ErrSSHFxBadMessage = fxerr(sshFxBadMessage) 15 ErrSSHFxNoConnection = fxerr(sshFxNoConnection) 16 ErrSSHFxConnectionLost = fxerr(sshFxConnectionLost) 17 ErrSSHFxOpUnsupported = fxerr(sshFxOPUnsupported) 18) 19 20// Deprecated error types, these are aliases for the new ones, please use the new ones directly 21const ( 22 ErrSshFxOk = ErrSSHFxOk 23 ErrSshFxEof = ErrSSHFxEOF 24 ErrSshFxNoSuchFile = ErrSSHFxNoSuchFile 25 ErrSshFxPermissionDenied = ErrSSHFxPermissionDenied 26 ErrSshFxFailure = ErrSSHFxFailure 27 ErrSshFxBadMessage = ErrSSHFxBadMessage 28 ErrSshFxNoConnection = ErrSSHFxNoConnection 29 ErrSshFxConnectionLost = ErrSSHFxConnectionLost 30 ErrSshFxOpUnsupported = ErrSSHFxOpUnsupported 31) 32 33func (e fxerr) Error() string { 34 switch e { 35 case ErrSSHFxOk: 36 return "OK" 37 case ErrSSHFxEOF: 38 return "EOF" 39 case ErrSSHFxNoSuchFile: 40 return "no such file" 41 case ErrSSHFxPermissionDenied: 42 return "permission denied" 43 case ErrSSHFxBadMessage: 44 return "bad message" 45 case ErrSSHFxNoConnection: 46 return "no connection" 47 case ErrSSHFxConnectionLost: 48 return "connection lost" 49 case ErrSSHFxOpUnsupported: 50 return "operation unsupported" 51 default: 52 return "failure" 53 } 54} 55