X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fcommand.php;fp=lib%2Fcommand.php;h=e93b7fbfee62bb2237b9a69fdb7fb8e0cf8816dd;hb=e5e3aeb4e67cece90f04ae89c8e2714af4817e56;hp=ae97b9facd31c3dd8801002d4901735a883940f2;hpb=89b10666bb25fc2dc016c246b55e219d6e8138e1;p=quix0rs-gnu-social.git diff --git a/lib/command.php b/lib/command.php index ae97b9facd..e93b7fbfee 100644 --- a/lib/command.php +++ b/lib/command.php @@ -632,15 +632,15 @@ class MessageCommand extends Command $channel->error($this->user, _('Do not send a message to yourself; just say it to yourself quietly instead.')); return; } - $message = Message::saveNew($this->user->id, $other->id, $this->text, $channel->source()); - if ($message) { + try { + $message = Message::saveNew($this->user->id, $other->id, $this->text, $channel->source()); $message->notify(); // TRANS: Message given have sent a direct message to another user. // TRANS: %s is the name of the other user. $channel->output($this->user, sprintf(_('Direct message to %s sent.'), $this->other)); - } else { + } catch (Exception $e) { // TRANS: Error text shown sending a direct message fails with an unknown reason. - $channel->error($this->user, _('Error sending direct message.')); + $channel->error($this->user, $e->getMessage()); } } }