Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/validation/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ var (
// ErrorMaintenanceMode will be sent if there is ongoing maintenance
// Code: 20005
ErrorMaintenanceMode = Error{errors.New("maintenance mode active")}

// ErrorRequestThrottled will be sent if the request has been throttled
// Code: 20005
ErrorRequestThrottled = Error{errors.New("request has been throttled")}
)

// Code will return the code of the error
Expand Down
4 changes: 2 additions & 2 deletions src/webserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1223,15 +1223,15 @@ func TibiaDataHTMLDataCollector(TibiaDataRequest TibiaDataRequestStruct) (string
TibiaDataRequestTraceLogger(res, err)
}

if err != nil {
if err != nil || res.StatusCode() != http.StatusOK {
log.Printf("[error] TibiaDataHTMLDataCollector (Status: %s, URL: %s) in resp1: %s", res.Status(), res.Request.URL, err)

switch res.StatusCode() {
case http.StatusForbidden:
// throttled request
LogMessage = "request throttled due to rate-limitation on tibia.com"
log.Printf("[warning] TibiaDataHTMLDataCollector: %s!", LogMessage)
return "", err
return "", validation.ErrorRequestThrottled

case http.StatusFound:
// Check if page is in maintenance mode
Expand Down