forked from byte-mug/fastnntp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errorcode.go
102 lines (74 loc) · 4.3 KB
/
errorcode.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
MIT License
Copyright (c) 2017 Simon Schmidt
Copyright (c) 2012-2014 Dustin Sallings <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package fastnntp
// An NNTPError is a coded NNTP error message.
type NNTPError struct {
Code int
Msg string
}
// ErrNoSuchGroup is returned for a request for a group that can't be found.
var ErrNoSuchGroup = &NNTPError{411, "No such newsgroup"}
// ErrNoSuchGroup is returned for a request that requires a current
// group when none has been selected.
var ErrNoGroupSelected = &NNTPError{412, "No newsgroup selected"}
// ErrInvalidMessageID is returned when a message is requested that can't be found.
var ErrInvalidMessageID = &NNTPError{430, "No article with that message-id"}
// ErrInvalidArticleNumber is returned when an article is requested that can't be found.
var ErrInvalidArticleNumber = &NNTPError{423, "No article with that number"}
// ErrInvalidArticleNumber with other text
var ErrInvalidArticleRange = &NNTPError{423, "No articles in that range"}
// ErrNoCurrentArticle is returned when a command is executed that
// requires a current article when one has not been selected.
var ErrNoCurrentArticle = &NNTPError{420, "Current article number is invalid"}
// ErrNoNextArticle is returned when LAST or NEXT reaches the end of its iteration
var ErrNoNextArticle = &NNTPError{421, "No next article to retrieve"}
// ErrNoPreviousArticle is returned when LAST or NEXT reaches the end of its iteration
var ErrNoPreviousArticle = &NNTPError{422, "No previous article to retrieve"}
// ErrUnknownCommand is returned for unknown comands.
var ErrUnknownCommand = &NNTPError{500, "Unknown command"}
// ErrSyntax is returned when a command can't be parsed.
var ErrSyntax = &NNTPError{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 = &NNTPError{440, "Posting not permitted"}
// ErrPostingFailed is returned when an attempt to post an article fails.
var ErrPostingFailed = &NNTPError{441, "posting failed"}
// ErrNotWanted is returned when an attempt to ihave an article is
// rejected due the server not wanting the article.
var ErrNotWanted = &NNTPError{435, "Article not wanted"}
// ErrIHaveNopPossible is the same as ErrIHaveFailed, except the text.
// ErrIHaveNopPossible is returned when an attempt to ihave an article fails
// BEFORE the transfer of the article.
var ErrIHaveNotPossible = &NNTPError{436, "Transfer not possible; try again later"}
// ErrIHaveFailed is returned when an attempt to ihave an article fails
// AFTER the transfer of the article.
var ErrIHaveFailed = &NNTPError{436, "Transfer failed; try again later"}
// ErrIHaveRejected is returned when an attempt to ihave an article is
// rejected due the server not wanting the article.
var ErrIHaveRejected = &NNTPError{437, "Transfer rejected; do not retry"}
// ErrAuthRequired is returned to indicate authentication is required
// to proceed.
var ErrAuthRequired = &NNTPError{450, "authorization required"}
// ErrAuthRejected is returned for invalid authentication.
var ErrAuthRejected = &NNTPError{452, "authorization rejected"}
// ErrNotAuthenticated is returned when a command is issued that requires
// authentication, but authentication was not provided.
var ErrNotAuthenticated = &NNTPError{480, "authentication required"}