Add status string for unknown status codes
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package ftp
|
||||
|
||||
import "fmt"
|
||||
|
||||
// FTP status codes, defined in RFC 959
|
||||
const (
|
||||
StatusInitiating = 100
|
||||
@@ -109,5 +111,9 @@ var statusText = map[int]string{
|
||||
|
||||
// StatusText returns a text for the FTP status code. It returns the empty string if the code is unknown.
|
||||
func StatusText(code int) string {
|
||||
return statusText[code]
|
||||
str, ok := statusText[code]
|
||||
if !ok {
|
||||
str = fmt.Sprintf("Unknown status code: %d", code)
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user