5 ba988fd4 2024-03-28 o // An NNTPError is a coded NNTP error message.
6 ba988fd4 2024-03-28 o type Error struct {
11 ba988fd4 2024-03-28 o func (e *Error) Error() string {
12 ba988fd4 2024-03-28 o return fmt.Sprintf("%d %s", e.Code, e.Msg)
15 ba988fd4 2024-03-28 o // ErrNoSuchGroup is returned for a request for a group that can't be found.
16 ba988fd4 2024-03-28 o var ErrNoSuchGroup = &Error{411, "No such newsgroup"}
18 ba988fd4 2024-03-28 o // ErrNoSuchGroup is returned for a request that requires a current
19 ba988fd4 2024-03-28 o // group when none has been selected.
20 ba988fd4 2024-03-28 o var ErrNoGroupSelected = &Error{412, "No newsgroup selected"}
22 ba988fd4 2024-03-28 o // ErrInvalidMessageID is returned when a message is requested that can't be found.
23 ba988fd4 2024-03-28 o var ErrInvalidMessageID = &Error{430, "No article with that message-id"}
25 ba988fd4 2024-03-28 o // ErrInvalidArticleNumber is returned when an article is requested that can't be found.
26 ba988fd4 2024-03-28 o var ErrInvalidArticleNumber = &Error{423, "No article with that number"}
28 ba988fd4 2024-03-28 o // ErrNoCurrentArticle is returned when a command is executed that
29 ba988fd4 2024-03-28 o // requires a current article when one has not been selected.
30 ba988fd4 2024-03-28 o var ErrNoCurrentArticle = &Error{420, "Current article number is invalid"}
32 ba988fd4 2024-03-28 o // ErrUnknownCommand is returned for unknown comands.
33 ba988fd4 2024-03-28 o var ErrUnknownCommand = &Error{500, "Unknown command"}
35 ba988fd4 2024-03-28 o // ErrSyntax is returned when a command can't be parsed.
36 ba988fd4 2024-03-28 o var ErrSyntax = &Error{501, "not supported, or syntax error"}
38 ba988fd4 2024-03-28 o // ErrPostingNotPermitted is returned as the response to an attempt to
39 ba988fd4 2024-03-28 o // post an article where posting is not permitted.
40 ba988fd4 2024-03-28 o var ErrPostingNotPermitted = &Error{440, "posting not permitted"}
42 ba988fd4 2024-03-28 o // ErrPostingFailed is returned when an attempt to post an article fails.
43 ba988fd4 2024-03-28 o var ErrPostingFailed = &Error{441, "posting failed"}
45 ba988fd4 2024-03-28 o // ErrNotWanted is returned when an attempt to post an article is
46 ba988fd4 2024-03-28 o // rejected due the server not wanting the article.
47 ba988fd4 2024-03-28 o var ErrNotWanted = &Error{435, "Article not wanted"}
49 ba988fd4 2024-03-28 o // ErrAuthRequired is returned to indicate authentication is required
51 ba988fd4 2024-03-28 o var ErrAuthRequired = &Error{450, "authorization required"}
53 ba988fd4 2024-03-28 o // ErrAuthRejected is returned for invalid authentication.
54 ba988fd4 2024-03-28 o var ErrAuthRejected = &Error{452, "authorization rejected"}
56 ba988fd4 2024-03-28 o // ErrNotAuthenticated is returned when a command is issued that requires
57 ba988fd4 2024-03-28 o // authentication, but authentication was not provided.
58 ba988fd4 2024-03-28 o var ErrNotAuthenticated = &Error{480, "authentication required"}