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
Comment #1
kevin.dutra commentedComment #2
kevin.dutra commentedHere's the D6 patch too
Comment #4
marcingy commentedD7 and D6 versions look good.
Comment #5
ygerasimov commentedShould
$this->data = isset($data) ? $data : $message;be something like$this->data = !empty($data) ? $data : $message;?Comment #6
kevin.dutra commentedThat would work too.
Comment #7
ygerasimov commentedCommitted. Thank you very much for reroll.
Comment #9
bryanhirsch commentedRerolled 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.)