Skip to content

Commit

Permalink
Update Project at Wed Mar 29 11:19:05 +07 2023
Browse files Browse the repository at this point in the history
  • Loading branch information
hungnguyenhp committed Mar 29, 2023
1 parent 967ed42 commit 5305b27
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions helpers/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function bear_str_length($str)
/**
* Function __get_error_message__
*
* @param \Exception $e
* @param \Exception|\Throwable $e
*
* @return string
* @author : 713uk13m <dev@nguyenanhung.com>
Expand All @@ -57,7 +57,7 @@ function __get_error_message__($e)
/**
* Function __get_error_trace__
*
* @param \Exception $e
* @param \Exception|\Throwable $e
*
* @return string
* @author : 713uk13m <dev@nguyenanhung.com>
Expand Down
15 changes: 7 additions & 8 deletions hungng/HungNG_CI_Base_Controllers.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,8 @@ protected function jsonResponsePretty($response = array(), $status = 200)
*/
protected function errorExceptionResponse($exception)
{
$errorMessage = "Error Code: " . $exception->getCode() . " - Error File: " . $exception->getFile() . " - Error Line: " . $exception->getLine() . " - Error Message: " . $exception->getMessage();
log_message('error', $errorMessage);
log_message('error', $exception->getTraceAsString());
log_message('error', __get_error_message__($exception));
log_message('error', __get_error_trace__($exception));

$response = array();
$response['code'] = StatusCodes::HTTP_BAD_REQUEST;
Expand Down Expand Up @@ -366,11 +365,11 @@ protected function log($name = '', $message = '', $context = array(), $inputLeve
log_message($inputLevel, $name . " | Error Message: " . $message . ' | Context: ' . json_encode($context));
}
} catch (InvalidArgumentException $exception) {
log_message('error', $exception->getMessage());
log_message('error', $exception->getTraceAsString());
log_message('error', __get_error_message__($exception));
log_message('error', __get_error_trace__($exception));
} catch (Exception $exception) {
log_message('error', $exception->getMessage());
log_message('error', $exception->getTraceAsString());
log_message('error', __get_error_message__($exception));
log_message('error', __get_error_trace__($exception));
}
}

Expand Down Expand Up @@ -422,7 +421,7 @@ protected function default_base_flush_logs()
$this->output->set_status_header()->set_content_type('application/json', 'utf-8')->set_output($output . PHP_EOL)->_display();
exit;
} catch (Exception $e) {
$message = 'Code: ' . $e->getCode() . ' - File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Message: ' . $e->getMessage();
$message = __get_error_message__($e);
log_message('error', $message);
echo $message . PHP_EOL;
exit;
Expand Down
15 changes: 7 additions & 8 deletions hungng/HungNG_CI_Base_Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,8 @@ protected function jsonResponsePretty($response = array(), $status = 200)
*/
protected function errorExceptionResponse($exception)
{
$errorMessage = "Error Code: " . $exception->getCode() . " - Error File: " . $exception->getFile() . " - Error Line: " . $exception->getLine() . " - Error Message: " . $exception->getMessage();
log_message('error', $errorMessage);
log_message('error', $exception->getTraceAsString());
log_message('error', __get_error_message__($exception));
log_message('error', __get_error_trace__($exception));

$response = array();
$response['code'] = StatusCodes::HTTP_BAD_REQUEST;
Expand Down Expand Up @@ -366,11 +365,11 @@ protected function log($name = '', $message = '', $context = array(), $inputLeve
log_message($inputLevel, $name . " | Error Message: " . $message . ' | Context: ' . json_encode($context));
}
} catch (InvalidArgumentException $exception) {
log_message('error', $exception->getMessage());
log_message('error', $exception->getTraceAsString());
log_message('error', __get_error_message__($exception));
log_message('error', __get_error_trace__($exception));
} catch (Exception $exception) {
log_message('error', $exception->getMessage());
log_message('error', $exception->getTraceAsString());
log_message('error', __get_error_message__($exception));
log_message('error', __get_error_trace__($exception));
}
}

Expand Down Expand Up @@ -422,7 +421,7 @@ protected function default_base_flush_logs()
$this->output->set_status_header()->set_content_type('application/json', 'utf-8')->set_output($output . PHP_EOL)->_display();
exit;
} catch (Exception $e) {
$message = 'Code: ' . $e->getCode() . ' - File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Message: ' . $e->getMessage();
$message = __get_error_message__($e);
log_message('error', $message);
echo $message . PHP_EOL;
exit;
Expand Down

0 comments on commit 5305b27

Please sign in to comment.