mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Improving error reporting API
This commit is contained in:
parent
31720b59fd
commit
170ee5a40b
@ -283,22 +283,16 @@ class InvoiceApiController extends BaseAPIController
|
|||||||
$data = Input::all();
|
$data = Input::all();
|
||||||
$error = null;
|
$error = null;
|
||||||
|
|
||||||
Log::info($data);
|
|
||||||
|
|
||||||
$invoice = Invoice::scope($data['id'])->withTrashed()->first();
|
$invoice = Invoice::scope($data['id'])->withTrashed()->first();
|
||||||
|
|
||||||
if(!$invoice)
|
if(!$invoice)
|
||||||
return $this->errorResponse(['message'=>'Invoice does not exist.'], 400);
|
return $this->errorResponse(['message'=>'Invoice does not exist.'], 400);
|
||||||
|
|
||||||
try {
|
|
||||||
$this->mailer->sendInvoice($invoice);
|
|
||||||
}
|
|
||||||
catch(\Exception $e)
|
|
||||||
{
|
|
||||||
$this->errorResponse(['message'=>'There was an error sending the invoice'], 400);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($error) {
|
$emailResponse = $this->mailer->sendInvoice($invoice, false, false);
|
||||||
|
|
||||||
|
|
||||||
|
if($emailResponse === FALSE) {
|
||||||
return $this->errorResponse(['message'=>'There was an error sending the invoice'], 400);
|
return $this->errorResponse(['message'=>'There was an error sending the invoice'], 400);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user