use report instead of logger

This commit is contained in:
Denis Duliçi 2021-06-08 23:33:17 +03:00
parent 5ddfe315f4
commit 8dae25abc5
8 changed files with 14 additions and 19 deletions

View File

@ -6,8 +6,7 @@ use App\Events\Document\DocumentReminded;
use App\Models\Common\Company;
use App\Models\Document\Document;
use App\Notifications\Purchase\Bill as Notification;
use App\Utilities\Overrider;
use Date;
use App\Utilities\Date;
use Illuminate\Console\Command;
class BillReminder extends Command
@ -80,10 +79,10 @@ class BillReminder extends Command
foreach ($bills as $bill) {
try {
event(new DocumentReminded($bill, Notification::class));
} catch (\Exception | \Throwable | \Swift_RfcComplianceException | \Illuminate\Database\QueryException $e) {
} catch (\Throwable $e) {
$this->error($e->getMessage());
logger('Bill reminder:: ' . $e->getMessage());
report($e);
}
}
}

View File

@ -6,8 +6,7 @@ use App\Events\Document\DocumentReminded;
use App\Models\Common\Company;
use App\Models\Document\Document;
use App\Notifications\Sale\Invoice as Notification;
use App\Utilities\Overrider;
use Date;
use App\Utilities\Date;
use Illuminate\Console\Command;
class InvoiceReminder extends Command
@ -80,10 +79,10 @@ class InvoiceReminder extends Command
foreach ($invoices as $invoice) {
try {
event(new DocumentReminded($invoice, Notification::class));
} catch (\Exception | \Throwable | \Swift_RfcComplianceException | \Illuminate\Database\QueryException $e) {
} catch (\Throwable $e) {
$this->error($e->getMessage());
logger('Invoice reminder:: ' . $e->getMessage());
report($e);
}
}
}

View File

@ -162,10 +162,10 @@ class RecurringCheck extends Command
try {
return $this->$function($model, $schedule_date);
} catch (\Exception | \Throwable | \Swift_RfcComplianceException| \Swift_TransportException | \Illuminate\Database\QueryException $e) {
} catch (\Throwable $e) {
$this->error($e->getMessage());
logger('Recurring check:: ' . $e->getMessage());
report($e);
return false;
}

View File

@ -95,7 +95,7 @@ class Money
$amount = money($money_format, $currency_code)->getAmount();
} catch (InvalidArgumentException | OutOfBoundsException | UnexpectedValueException $e) {
logger($e->getMessage());
report($e);
$amount = 0;

View File

@ -53,7 +53,7 @@ class InstallExtraModules
$this->dispatch(new InstallModule($alias, $event->company_id, $event->locale));
} catch (\Exception $e) {
logger($e->getMessage());
report($e);
// Stop the propagation of event if the required module failed to install
return false;

View File

@ -58,7 +58,7 @@ class UpdateExtraModules
if (true !== $result = Console::run($command)) {
$message = !empty($result) ? $result : trans('modules.errors.finish', ['module' => $alias]);
logger($message);
report($message);
// Stop the propagation of event if the required module failed to update
return false;

View File

@ -42,7 +42,7 @@ class App extends Provider
Model::handleLazyLoadingViolationUsing(function ($model, $relation) {
$class = get_class($model);
logger("Attempted to lazy load [{$relation}] on model [{$class}].");
report("Attempted to lazy load [{$relation}] on model [{$class}].");
});
}
}

View File

@ -3,9 +3,6 @@
namespace App\Traits;
use Akaunting\Money\Money;
use InvalidArgumentException;
use OutOfBoundsException;
use UnexpectedValueException;
trait Currencies
{
@ -20,8 +17,8 @@ trait Currencies
try {
$money = $money->$method((double) $rate);
} catch (InvalidArgumentException | OutOfBoundsException | UnexpectedValueException $e) {
logger($e->getMessage());
} catch (\Throwable $e) {
report($e);
return 0;
}