Skip to content

Commit 2113564

Browse files
committed
adding ErrorMaintenanceMode
1 parent 5ff636f commit 2113564

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/validation/errors.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ var (
193193
// ErrorGuildNotFound will be sent if the requested guild does not exist
194194
// Code: 20004
195195
ErrorGuildNotFound = Error{errors.New("could not find guild")}
196+
197+
// ErrorMaintenanceMode will be sent if there is ongoing maintenance
198+
// Code: 20005
199+
ErrorMaintenanceMode = Error{errors.New("maintenance mode active")}
196200
)
197201

198202
// Code will return the code of the error
@@ -284,6 +288,8 @@ func (e Error) Code() int {
284288
return 20003
285289
case ErrorGuildNotFound:
286290
return 20004
291+
case ErrorMaintenanceMode:
292+
return 20005
287293
default:
288294
return 0
289295
}

src/validation/validation_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,9 @@ func TestErrors(t *testing.T) {
597597
ErrorGuildNotFound: {
598598
Code: 20004,
599599
},
600+
ErrorMaintenanceMode: {
601+
Code: 20005,
602+
}
600603
}
601604

602605
for err, values := range errs {

src/webserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ func TibiaDataHTMLDataCollector(TibiaDataRequest TibiaDataRequestStruct) (string
12291229
if location.Host == "maintenance.tibia.com" {
12301230
LogMessage := "maintenance mode detected on tibia.com"
12311231
log.Printf("[info] TibiaDataHTMLDataCollector: %s!", LogMessage)
1232-
return "", err
1232+
return "", validation.ErrorMaintenanceMode
12331233
}
12341234
fallthrough
12351235

0 commit comments

Comments
 (0)