mirror of
https://github.com/TwiN/gatus.git
synced 2024-12-22 06:31:15 +01:00
refactor: Use %w instead of %s for formatting errors
This commit is contained in:
parent
17c14a7243
commit
5bb3f6d0a9
@ -853,16 +853,16 @@ func extractKeyAndParamsFromCacheKey(cacheKey string) (string, *paging.EndpointS
|
||||
params := &paging.EndpointStatusParams{}
|
||||
var err error
|
||||
if params.EventsPage, err = strconv.Atoi(parts[len(parts)-4]); err != nil {
|
||||
return "", nil, fmt.Errorf("invalid cache key: %s", err.Error())
|
||||
return "", nil, fmt.Errorf("invalid cache key: %w", err)
|
||||
}
|
||||
if params.EventsPageSize, err = strconv.Atoi(parts[len(parts)-3]); err != nil {
|
||||
return "", nil, fmt.Errorf("invalid cache key: %s", err.Error())
|
||||
return "", nil, fmt.Errorf("invalid cache key: %w", err)
|
||||
}
|
||||
if params.ResultsPage, err = strconv.Atoi(parts[len(parts)-2]); err != nil {
|
||||
return "", nil, fmt.Errorf("invalid cache key: %s", err.Error())
|
||||
return "", nil, fmt.Errorf("invalid cache key: %w", err)
|
||||
}
|
||||
if params.ResultsPageSize, err = strconv.Atoi(parts[len(parts)-1]); err != nil {
|
||||
return "", nil, fmt.Errorf("invalid cache key: %s", err.Error())
|
||||
return "", nil, fmt.Errorf("invalid cache key: %w", err)
|
||||
}
|
||||
return strings.Join(parts[:len(parts)-4], "-"), params, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user