Skip to content

Commit b3b7f5e

Browse files
committed
feat: bring back -503 Timeout error
Looks like it is valid exception. Also trim space and omitempty description.
1 parent 944d384 commit b3b7f5e

File tree

3 files changed

+18
-26
lines changed

3 files changed

+18
-26
lines changed

_schema/121.json

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28206,8 +28206,7 @@
2820628206
},
2820728207
{
2820828208
"code": 420,
28209-
"type": "P0NY_FLOODWAIT",
28210-
"description": " "
28209+
"type": "P0NY_FLOODWAIT"
2821128210
},
2821228211
{
2821328212
"code": 400,
@@ -28408,8 +28407,8 @@
2840828407
"description": "The provided peer id is invalid"
2840928408
},
2841028409
{
28411-
"code": 503,
28412-
"type": "TIMEOUT",
28410+
"code": -503,
28411+
"type": "Timeout",
2841328412
"description": "Timeout while fetching data"
2841428413
}
2841528414
]
@@ -28936,8 +28935,8 @@
2893628935
"description": "Invalid message ID provided"
2893728936
},
2893828937
{
28939-
"code": 503,
28940-
"type": "TIMEOUT",
28938+
"code": -503,
28939+
"type": "Timeout",
2894128940
"description": "Timeout while fetching data"
2894228941
}
2894328942
]
@@ -29286,8 +29285,7 @@
2928629285
"errors": [
2928729286
{
2928829287
"code": 403,
29289-
"type": "BROADCAST_FORBIDDEN",
29290-
"description": " "
29288+
"type": "BROADCAST_FORBIDDEN"
2929129289
},
2929229290
{
2929329291
"code": 400,
@@ -34291,8 +34289,7 @@
3429134289
},
3429234290
"BROADCAST_FORBIDDEN": {
3429334291
"code": 403,
34294-
"type": "BROADCAST_FORBIDDEN",
34295-
"description": " "
34292+
"type": "BROADCAST_FORBIDDEN"
3429634293
},
3429734294
"BROADCAST_ID_INVALID": {
3429834295
"code": 400,
@@ -34986,8 +34983,7 @@
3498634983
},
3498734984
"P0NY_FLOODWAIT": {
3498834985
"code": 420,
34989-
"type": "P0NY_FLOODWAIT",
34990-
"description": " "
34986+
"type": "P0NY_FLOODWAIT"
3499134987
},
3499234988
"PACK_SHORT_NAME_INVALID": {
3499334989
"code": 400,
@@ -35479,11 +35475,6 @@
3547935475
"type": "THEME_INVALID",
3548035476
"description": "Invalid theme provided"
3548135477
},
35482-
"TIMEOUT": {
35483-
"code": 503,
35484-
"type": "TIMEOUT",
35485-
"description": "Timeout while fetching data"
35486-
},
3548735478
"TMP_PASSWORD_DISABLED": {
3548835479
"code": 400,
3548935480
"type": "TMP_PASSWORD_DISABLED",
@@ -35509,6 +35500,11 @@
3550935500
"type": "TYPES_EMPTY",
3551035501
"description": "No top peer type was provided"
3551135502
},
35503+
"Timeout": {
35504+
"code": -503,
35505+
"type": "Timeout",
35506+
"description": "Timeout while fetching data"
35507+
},
3551235508
"UNTIL_DATE_INVALID": {
3551335509
"code": 400,
3551435510
"type": "UNTIL_DATE_INVALID",

internal/bindata.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

method.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type Method struct {
2323
type Error struct {
2424
Code int `json:"code"`
2525
Type string `json:"type"`
26-
Description string `json:"description"`
26+
Description string `json:"description,omitempty"`
2727
}
2828

2929
func docBotCanUser(doc *goquery.Document) bool {
@@ -49,12 +49,8 @@ func docErrors(doc *goquery.Document) []Error {
4949
}
5050
e := Error{
5151
Code: code,
52-
Type: strings.ToUpper(rowContents[1]),
53-
Description: rowContents[2],
54-
}
55-
if e.Code < 0 {
56-
// Normalize code. Correct value is positive.
57-
e.Code *= -1
52+
Type: strings.TrimSpace(rowContents[1]),
53+
Description: strings.TrimSpace(rowContents[2]),
5854
}
5955
output = append(output, e)
6056
})

0 commit comments

Comments
 (0)