diff --git a/src/validation/errors.go b/src/validation/errors.go index c0621f73..97d3786d 100644 --- a/src/validation/errors.go +++ b/src/validation/errors.go @@ -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 diff --git a/src/webserver.go b/src/webserver.go index 70e5f39a..f168fdd2 100644 --- a/src/webserver.go +++ b/src/webserver.go @@ -1223,7 +1223,7 @@ 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() { @@ -1231,7 +1231,7 @@ func TibiaDataHTMLDataCollector(TibiaDataRequest TibiaDataRequestStruct) (string // 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