Attempt to catch errors creating address for dovenet mail

This commit is contained in:
Deon George 2023-10-04 12:17:16 +11:00
parent 62f0c1a909
commit c7e707c143
2 changed files with 6 additions and 2 deletions

View File

@ -5,6 +5,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
@ -468,8 +469,8 @@ class Address extends Model
try {
$so->addresses()->save($o);
} catch (\Exception $e) {
Log::error(sprintf('%s:! ERROR creating address [%s]',self::LOGKEY,get_class($e)));
} catch (QueryException $e) {
Log::error(sprintf('%s:! ERROR creating address [%s] (%s)',self::LOGKEY,$o->ftn,get_class($e)));
return NULL;
}

View File

@ -3,6 +3,7 @@
namespace App\Traits;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use App\Http\Controllers\DomainController;
use App\Models\{Address,System,Zone};
@ -51,6 +52,8 @@ trait ParseAddresses
case 'path':
if (! $ao) {
$ftn = sprintf('%d:%d/%d@%s',$zone->zone_id,$net&DomainController::NUMBER_MAX,$node&DomainController::NUMBER_MAX,$zone->domain->name);
Log::info(sprintf('%s:- Creating address [%s] for path',self::LOGKEY,$ftn));
$ao = Address::createFTN($ftn,System::createUnknownSystem());
}