CRM-21371 An api error when calling drush cvapi should be treated as a drush error

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.28
    • Fix Version/s: 4.7.30
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code
    • Verified?:
      No

      Description

      Currently drush output that it gets an error when a drush cvapi call results in an error - but it does not treat it as an error, meaning it does not bubble up.

       

      Adding these lines to our drush will cause much more foam

       

      ```

      if (!empty($result['is_error'])) {
        drush_set_error('CIVICRM api error', $result['error_message']);
      }

      ```

      Mathieu Lutfy Mark Hanna Jamie McClelland ping

        Attachments

          Activity

          [CRM-21371] An api error when calling drush cvapi should be treated as a drush error
          Jamie McClelland added a comment -

          Nice Eileen - I just tried it out and got the drush "Error" message when the Civi API throws an error.

          The best part about this change is getting an exit code of "1" when there is an error.

            People

            • Assignee:
              Eileen McNaughton
              Reporter:
              Eileen McNaughton

              Dates

              • Created:
                Updated:
                Resolved: