Skip to content

Commit

Permalink
Fix: Exception is more cleared, specified and code restructured
Browse files Browse the repository at this point in the history
  • Loading branch information
arif98741 committed Apr 7, 2023
1 parent e9feb3a commit c0de8c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 28 deletions.
21 changes: 8 additions & 13 deletions src/Exception/ExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,23 @@
namespace Xenon\NagadApi\Exception;


use Throwable;

class ExceptionHandler extends \Exception
{

public function __construct($message = "", $code = 0, Throwable $previous = null)
/**
* Report the exception.
*
* @return void
*/
public function report()
{
parent::__construct($message, $code, $previous);
}

/**
* Generate Custom Exception
* @return array
* @return void
*/
public function generateException(): array
public function render()
{
return [
'error' => 'error',
'message' => $this->getMessage(),
'line' => $this->getLine(),
'file' => $this->getFile()
];

}
}
15 changes: 0 additions & 15 deletions src/Exception/NagadPaymentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,9 @@

class NagadPaymentException extends \Exception
{

public function __construct($message = "", $code = 0, Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}

/**
* Generate Custom Exception
* @return array
*/
public function generateException(): array
{
return [
'error' => 'error',
'message' => $this->getMessage(),
'line' => $this->getLine(),
'file' => $this->getFile()
];

}
}

0 comments on commit c0de8c4

Please sign in to comment.