update contact recode and clean up

This commit is contained in:
hazim
2019-03-07 16:10:10 +08:00
parent 46fe8430ef
commit 6e21b42ef9
2 changed files with 8 additions and 4 deletions
@@ -1,13 +1,16 @@
<?php
namespace App\Classes\Modules\Contacts\Exceptions;
use App\Classes\Exceptions\Common\ErrorException;
use App\Classes\ValueObjects\Constants\HttpStatus;
/**
* Created by PhpStorm.
* User: user
* Date: 07/03/2019
* Time: 3:25 PM
*/
final class CannotCreateContactException
final class CannotCreateContactException extends ErrorException
{
/** @param string $message */
@@ -16,6 +19,6 @@ final class CannotCreateContactException
*/
public function __construct(string $message)
{
parent::_construct($message,HttpStatus::BAD_REQUEST);
}
}
@@ -4,6 +4,7 @@ namespace App\Modules\ControllerLogic\Contacts;
use App\Classes\Constants;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Exceptions\CannotCreateContactException;
use App\Classes\Modules\Contacts\Services\CreatesContact;
use Illuminate\Http\Request;
@@ -30,8 +31,8 @@ class CreateContactLogic
return $this->createContact->execute($object, $type, $referenceId);
}
catch (){
catch (CannotCreateContactException $exception){
throw new InternalServerErrorException("Failed to create contact because {$exception->getMessage()}");
}
}