[NOD-481] Fix /blocks limit error message for api server (#504)

This commit is contained in:
Dan Aharoni 2019-12-01 16:19:14 +02:00 committed by Svarog
parent dbf9c09a2e
commit 3dcf8d88b8

View File

@ -55,7 +55,8 @@ func GetBlockByHashHandler(blockHash string) (interface{}, error) {
// GetBlocksHandler searches for all blocks
func GetBlocksHandler(order string, skip uint64, limit uint64) (interface{}, error) {
if limit > maxGetBlocksLimit {
return nil, httpserverutils.NewHandlerError(http.StatusUnprocessableEntity, errors.Errorf("The maximum allowed value for the limit is %d", maxGetBlocksLimit))
return nil, httpserverutils.NewHandlerError(http.StatusBadRequest,
errors.Errorf("Limit higher than %d or lower than 0 was requested.", maxGetBlocksLimit))
}
blocks := []*dbmodels.Block{}
db, err := database.DB()