CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Should 0 results be an error?
Pages: [1]

Author Topic: Should 0 results be an error?  (Read 2087 times)

cap10morgan

  • I post occasionally
  • **
  • Posts: 56
  • Karma: 9
Should 0 results be an error?
May 05, 2009, 09:41:42 am
Another standard I'd like to propose for the API: When doing a get/search op, 0 results should never be an error. If the search fails because you left out required parameters or the code generated some exception, then that should return an error. But 0 results is a successful get/search (I would argue even if you passed in a specific id), it just didn't find anything matching the criteria you gave it. That shouldn't trigger the API client's error handling mechanism, it should just trigger whatever code logic is in place to handle 0 results (such as never going through a loop, for example).

Does anyone disagree?

I'm going to add this to the new API standard wiki page (http://wiki.civicrm.org/confluence/display/CRM/API+Conventions) for now, but if someone makes a compelling argument against it, it can be changed.
« Last Edit: May 05, 2009, 11:03:06 am by cap10morgan »

acrosman

  • Guest
Re: Should 0 results be an error?
May 05, 2009, 10:55:20 am
Sounds right to me.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Should 0 results be an error?

This forum was archived on 2017-11-26.