package nntp import "fmt" // An NNTPError is a coded NNTP error message. type Error struct { Code int Msg string } func (e *Error) Error() string { return fmt.Sprintf("%d %s", e.Code, e.Msg) } // ErrNoSuchGroup is returned for a request for a group that can't be found. var ErrNoSuchGroup = &Error{411, "No such newsgroup"} // ErrNoSuchGroup is returned for a request that requires a current // group when none has been selected. var ErrNoGroupSelected = &Error{412, "No newsgroup selected"} // ErrInvalidMessageID is returned when a message is requested that can't be found. var ErrInvalidMessageID = &Error{430, "No article with that message-id"} // ErrInvalidArticleNumber is returned when an article is requested that can't be found. var ErrInvalidArticleNumber = &Error{423, "No article with that number"} // ErrNoCurrentArticle is returned when a command is executed that // requires a current article when one has not been selected. var ErrNoCurrentArticle = &Error{420, "Current article number is invalid"} // ErrUnknownCommand is returned for unknown comands. var ErrUnknownCommand = &Error{500, "Unknown command"} // ErrSyntax is returned when a command can't be parsed. var ErrSyntax = &Error{501, "not supported, or syntax error"} // ErrPostingNotPermitted is returned as the response to an attempt to // post an article where posting is not permitted. var ErrPostingNotPermitted = &Error{440, "posting not permitted"} // ErrPostingFailed is returned when an attempt to post an article fails. var ErrPostingFailed = &Error{441, "posting failed"} // ErrNotWanted is returned when an attempt to post an article is // rejected due the server not wanting the article. var ErrNotWanted = &Error{435, "Article not wanted"} // ErrAuthRequired is returned to indicate authentication is required // to proceed. var ErrAuthRequired = &Error{450, "authorization required"} // ErrAuthRejected is returned for invalid authentication. var ErrAuthRejected = &Error{452, "authorization rejected"} // ErrNotAuthenticated is returned when a command is issued that requires // authentication, but authentication was not provided. var ErrNotAuthenticated = &Error{480, "authentication required"}