Skip to content

Commit

Permalink
aghio: improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed Nov 20, 2020
1 parent 60dc706 commit 1f5472a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
15 changes: 11 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@ and this project adheres to

## [Unreleased]

### Added

- Limiting request's body size ([#2305]).

[#2305]: https://github.com/AdguardTeam/AdGuardHome/issues/2305

### Changed

- Various internal improvements ([#2271], [#2297]).

[#2271]: https://github.com/AdguardTeam/AdGuardHome/issues/2271
[#2297]: https://github.com/AdguardTeam/AdGuardHome/issues/2297

## [v0.104.3] - 2020-11-19

Expand All @@ -31,10 +42,6 @@ and this project adheres to
### Changed

- Improved tests output ([#2273]).
- Various internal improvements ([#2271], [#2297]).

[#2271]: https://github.com/AdguardTeam/AdGuardHome/issues/2271
[#2297]: https://github.com/AdguardTeam/AdGuardHome/issues/2297

### Fixed

Expand Down
11 changes: 2 additions & 9 deletions internal/aghio/limitedreadcloser.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
package aghio

import (
"fmt"
"io"
"strconv"
"strings"
)

// LimitReachedError records the limit and the operation that caused it.
Expand All @@ -15,13 +14,7 @@ type LimitReachedError struct {
// Error implements error interface for LimitReachedError.
// TODO(a.garipov): Think about error string format.
func (lre *LimitReachedError) Error() string {
b := &strings.Builder{}

b.WriteString("attempted to read more than ")
b.WriteString(strconv.FormatInt(lre.Limit, 10))
b.WriteString(" bytes")

return b.String()
return fmt.Sprintf("attempted to read more than %d bytes", lre.Limit)
}

// limitedReadCloser is a wrapper for io.ReadCloser with limited reader and
Expand Down

0 comments on commit 1f5472a

Please sign in to comment.