forked from fclairamb/ftpserverlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
23 lines (20 loc) · 685 Bytes
/
Copy patherrors.go
File metadata and controls
23 lines (20 loc) · 685 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package ftpserver
import "errors"
var (
// ErrStorageExceeded defines the error mapped to the FTP 552 reply code.
// As for RFC 959 this error is checked for STOR, APPE
ErrStorageExceeded = errors.New("storage limit exceeded")
// ErrFileNameNotAllowed defines the error mapped to the FTP 553 reply code.
// As for RFC 959 this error is checked for STOR, APPE, RNTO
ErrFileNameNotAllowed = errors.New("filename not allowed")
)
func getErrorCode(err error, defaultCode int) int {
switch {
case errors.Is(err, ErrStorageExceeded):
return StatusActionAborted
case errors.Is(err, ErrFileNameNotAllowed):
return StatusActionNotTakenNoFile
default:
return defaultCode
}
}