diff options
author | Vidhu Kant Sharma <vidhukant@protonmail.ch> | 2022-02-13 14:12:45 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@protonmail.ch> | 2022-02-13 14:12:45 +0530 |
commit | 937f3b8ada85274dfe3842f3dde8aef45c4f3ae7 (patch) | |
tree | 7de3ab75005620e33f8aac32554695b7eecd552c /errhandlers/errhandlers.go | |
parent | 1d3f72c1b48998b86fd1740e893559b6dcaf7663 (diff) |
completed (?) the GetAnimeList function
Diffstat (limited to 'errhandlers/errhandlers.go')
-rw-r--r-- | errhandlers/errhandlers.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/errhandlers/errhandlers.go b/errhandlers/errhandlers.go index 50f4aac..a9f8054 100644 --- a/errhandlers/errhandlers.go +++ b/errhandlers/errhandlers.go @@ -41,10 +41,10 @@ func FieldsErrHandler(fields []string) ([]string, error) { } // if limit or error specified are above the limit -func LimitsErrHandler(limit, offset int) error { - maxOffset := 500 - limit - if limit > 500 { - return errors.New(fmt.Sprintf("InvalidLimitError: Limit specified too high (%d > 500).", limit)) +func LimitsErrHandler(limit, offset, maxLimit int) error { + maxOffset := maxLimit - limit + if limit > maxLimit { + return errors.New(fmt.Sprintf("InvalidLimitError: Limit specified too high (%d > %d).", limit, maxLimit)) } else if offset > maxOffset { return errors.New(fmt.Sprintf("InvalidOffsetError: Offset specified too high (%d > %d).", offset, maxOffset)) } |