Bug 1352953

Summary: show descriptive error message when sending a negative number like: {url}/events;max=-3
Product: [oVirt] ovirt-engine Reporter: Tareq Alayan <talayan>
Component: Search-BackendAssignee: Eli Mesika <emesika>
Status: CLOSED CURRENTRELEASE QA Contact: Gonza <grafuls>
Severity: low Docs Contact:
Priority: unspecified    
Version: 4.0.0CC: bugs, emesika, lsvaty, mperina
Target Milestone: ovirt-4.0.2Keywords: ZStream
Target Release: 4.0.2Flags: rule-engine: ovirt-4.0.z+
rule-engine: planning_ack+
mperina: devel_ack+
lsvaty: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-26 10:52:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tareq Alayan 2016-07-05 14:50:01 UTC
Description of problem:
when trying to get {engine_url}/ovirt-engine/api/events;max=-3

the error message returned is the postgresql message: 
<fault><detail>statementcallback; sql [select * from ((select distinct audit log.* from  audit log   where not deleted)  order by audit log id desc ) as t1 offset (1 -1) limit -2]; error: limit must not be negative; nested exception is org.postgresql.util.psqlexception: error: limit must not be negative</detail><reason>Operation Failed</reason></fault>


This should be replaced by application level error message

Version-Release number of selected component (if applicable):
rhevm-4.0.2-0.2.rc1.el7ev.noarch

How reproducible:
always


Steps to Reproduce:
1.GET {engine_url}/ovirt-engine/api/events;max=-3 


additional info: 
looks like all max functionality with other entities returns non decriptive error messages. 
i checked  ovirt-engine/api/tags;max=-2

and it returned 
<fault><detail>fromIndex(0) > toIndex(-2)</detail><reason>Operation Failed</reason></fault>

Comment 1 Yaniv Kaul 2016-07-18 13:50:44 UTC
I don't see what's the point of fixing such issues. What is the consequence of sending a negative number?

Comment 2 Eli Mesika 2016-07-18 14:01:16 UTC
(In reply to Yaniv Kaul from comment #1)
> I don't see what's the point of fixing such issues. What is the consequence
> of sending a negative number?

Sending a negative number is one issue and I agree that this is minor, but the bug is that the message of the exception thrown is not exposed to the API and it can occur in other scenarios as well since the exception is actually swallowed and just writes to the log so the respond returned to the API had a general failure with an unknown reason ...

Comment 3 Martin Perina 2016-07-19 08:57:57 UTC
Moving back to POST as we need to backport the patch to ovirt-engine-4.0 branch

Comment 4 Martin Perina 2016-07-19 12:05:54 UTC
Retargeting to 4.0.2 as patch is already merged to ovirt-engine-4.0 branch

Comment 5 Lukas Svaty 2016-07-26 10:52:18 UTC
This bug was fixed and is slated to be in the upcoming version. As we
are focusing our testing at this phase on severe bugs, this bug was
closed without going through its verification step. If you think this
bug should be verified by QE, please set its severity to high and move
it back to ON_QA