fix: change variable name

This commit is contained in:
debugtalk
2022-01-05 21:39:09 +08:00
parent aa47b83ae2
commit 98a1db8daa
2 changed files with 7 additions and 7 deletions

View File

@@ -86,7 +86,7 @@ func (s *requestStats) logError(method, name, err string) {
entry = &statsError{
name: name,
method: method,
error: err,
errMsg: err,
}
s.errors[key] = entry
}
@@ -296,7 +296,7 @@ func (s *statsEntry) getStrippedReport() map[string]interface{} {
type statsError struct {
name string
method string
error string
errMsg string
occurrences int64
}
@@ -308,7 +308,7 @@ func (err *statsError) toMap() map[string]interface{} {
m := make(map[string]interface{})
m["method"] = err.method
m["name"] = err.name
m["error"] = err.error
m["error"] = err.errMsg
m["occurrences"] = err.occurrences
return m
}

View File

@@ -95,8 +95,8 @@ func TestLogError(t *testing.T) {
// md5("httpfailure500 error") = 547c38e4e4742c1c581f9e2809ba4f55
err500 := newStats.errors["547c38e4e4742c1c581f9e2809ba4f55"]
if err500.error != "500 error" {
t.Error("Error message is wrong, expected: 500 error, got:", err500.error)
if err500.errMsg != "500 error" {
t.Error("Error message is wrong, expected: 500 error, got:", err500.errMsg)
}
if err500.occurrences != 1 {
t.Error("Error occurrences is wrong, expected: 1, got:", err500.occurrences)
@@ -104,8 +104,8 @@ func TestLogError(t *testing.T) {
// md5("httpfailure400 error") = f391c310401ad8e10e929f2ee1a614e4
err400 := newStats.errors["f391c310401ad8e10e929f2ee1a614e4"]
if err400.error != "400 error" {
t.Error("Error message is wrong, expected: 400 error, got:", err400.error)
if err400.errMsg != "400 error" {
t.Error("Error message is wrong, expected: 400 error, got:", err400.errMsg)
}
if err400.occurrences != 2 {
t.Error("Error occurrences is wrong, expected: 2, got:", err400.occurrences)