It used to be that you could pass additional information in a ServicesException via the $data argument of the constructor. It looks like at some point last year a commit was introduced to prevent a NULL body response. The diff is basically:

  public function __construct($message, $code = 0, $data = NULL) {
    parent::__construct($message, $code);

-   $this->data = $data;
+   $this->data = $message;
  }

This definitely prevents the NULL body in the response since the message argument is required, but it means that you can no longer pass additional information to the consumer of your service.

Comments

kevin.dutra’s picture

Status: Active » Needs review
StatusFileSize
new447 bytes
kevin.dutra’s picture

StatusFileSize
new411 bytes

Here's the D6 patch too

Status: Needs review » Needs work

The last submitted patch, exception-data-1935472-D6-1.patch, failed testing.

marcingy’s picture

Status: Needs work » Reviewed & tested by the community

D7 and D6 versions look good.

ygerasimov’s picture

Status: Reviewed & tested by the community » Needs work

Should $this->data = isset($data) ? $data : $message; be something like
$this->data = !empty($data) ? $data : $message;?

kevin.dutra’s picture

Status: Needs work » Needs review
StatusFileSize
new448 bytes
new412 bytes

That would work too.

ygerasimov’s picture

Status: Needs review » Fixed

Committed. Thank you very much for reroll.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

bryanhirsch’s picture

StatusFileSize
new412 bytes

Rerolled to apply cleanly on 7.x-3.3 after this patch:
http://drupal.org/node/1917432#comment-7084510

(I know this was committed on dev. We're running 7.x-3.3 in our production site, maintaining patches until 7.x-3.4 is out.)