peppeocchi / php-cron-scheduler

PHP cron job scheduler
MIT License
808 stars 143 forks source link

Try Catch #81

Open elvispdosreis opened 5 years ago

elvispdosreis commented 5 years ago

what would be the best way for me to define a try catch on each task so that one task is not harmed by the other

<?php
            $this->scheduler->call(function () use (&$skyhub) {
                $skyhub->invoice();
            })->at('0,30 * * * *')->then(function ($output) use (&$logger) {
                if (!empty($output)) {
                    $logger->error("Skyhub Invoice - {$output}");
                }
            });

            $this->scheduler->call(function () use (&$skyhub) {
                $skyhub->shipped();
            })->at('0,30 * * * *')->then(function ($output) use (&$logger) {
                if (!empty($output)) {
                    $logger->error("Skyhub Shipped - {$output}");
                }
            });