[ZBX-9340] api error response is missing "data" property in case of database down Created: 2015 Feb 24  Updated: 2017 May 30  Resolved: 2015 Oct 13

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 2.2.8, 2.4.4
Fix Version/s: 2.2.11rc1, 2.4.7rc1, 3.0.0alpha3

Type: Incident report Priority: Minor
Reporter: Gabriele Armao Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: errorreporting
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When Zabbix database is down, any api request correctly fails with a json error message (before 2.2, the error was not json, but just HTML, it was fixed in 2.2.x).
However the error message misses the "data" property:

{"jsonrpc":"2.0","error":{"code":1,"message":"Error connecting to database [No such file or directory]"},"id":0}

while the API documentation ( https://www.zabbix.com/documentation/2.4/manual/api) states that:

"If an error occurred, instead of the result property, the response object will contain an error property with the following data:

  • code - an error code;
  • message - a short error summary;
  • data - a more detailed error message."

so either the documentation needs to be updated or the error in this case, should also contain a "data" property.



 Comments   
Comment by Gabriele Armao [ 2015 Apr 01 ]

thanks for prettifying my ticket
could we please have at least an answer if this is actually a bug (so a fix that will add data property to the error message will be issued) or if it is the way it should (so documentation will be updated)? I need to know whether submit a patch to the PyZabbix api implementation or not.
thanks

Comment by Sergey Sorokin [ 2015 Apr 02 ]

Hi, Gabriele!
Just give me few hours

Comment by Sergey Sorokin [ 2015 Apr 02 ]

Hi again, Gabriele!

The issue will be corrected on API side in 2-3 weeks.

Have a Happy Easter!

Comment by Gabriele Armao [ 2015 Apr 02 ]

thanks Sergey for the update!

Comment by Gunars Pujats (Inactive) [ 2015 Sep 08 ]

(1) No translation strings changed.

iivs CLOSED.

Comment by Gunars Pujats (Inactive) [ 2015 Sep 08 ]

RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBX-9340

Comment by Ivo Kurzemnieks [ 2015 Oct 02 ]

(2) Now the message is duplicated in "data". Not sure if that's a good thing. Maybe we should display "message" like "Error connecting to database" and "data" could contain details returned by the database. Forexample "Unknown database 'test123'". It, however, would require a bit more serious changes. Should be discussed.

iivs Discussed with sasha and decided to not duplicate the message in data and leave it empty. The documentation should be updated mentioning the case when it is empty.

gunarspujats RESOLVED in r55953.

iivs CLOSED.

Comment by Gabriele Armao [ 2015 Oct 05 ]

fair enough.
just please, output the "data" property even if it's empty, because right now, the data property isn't included at all in the json, causing exceptions in the error handling of APIs implementation because the database down message is the only one missing the data property.

Comment by Ivo Kurzemnieks [ 2015 Oct 06 ]

TESTED.

Comment by Gunars Pujats (Inactive) [ 2015 Oct 09 ]

Fixed in:

  • pre-2.2.11 r56039
  • pre-2.4.7 r56040
  • pre-3.0.0alpha3 (trunk) r56041
Comment by Gunars Pujats (Inactive) [ 2015 Oct 09 ]

(3) API documentation:

iivs CLOSED.

Generated at Fri Apr 26 02:26:28 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.