Skip to content

Commit

Permalink
⚡ Added a extra error message for invalid json in test connection
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydeeptrivedi13 committed Jan 13, 2025
1 parent 9578dcd commit 1b6ccf9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion edwiser-bridge/includes/api/class-eb-connection-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,25 @@ public function connection_test_helper( $url, $token, $text_response = 0 ) {
if ( null === $body ) {
$url_link = "<a href='$url/auth/edwiserbridge/edwiserbridge.php?tab=summary'>here</a>";
$success = 0;
$plain_txt_msg = $response->get_error_message( __( 'Please check moodle web service configuration, Got invalid JSON,Check moodle web summary ', 'edwiser-bridge' ) );
$plain_txt_msg = __( 'Please check moodle web service configuration, Got invalid JSON,Check moodle web summary ', 'edwiser-bridge' );

$response_message = $this->create_response_message(
$request_url,
__( 'Please check moodle web service configuration, Got invalid JSON,Check moodle web summary ', 'edwiser-bridge' ) . $url_link
);
global $current_user;
wp_get_current_user();
$error_data = array(
'url' => $request_url,
'arguments' => $request_args,
'user' => isset( $current_user ) ? $current_user->user_login . '(' . $current_user->first_name . ' ' . $current_user->last_name . ')' : '',
'responsecode' => '',
'exception' => '',
'errorcode' => '',
'message' => $plain_txt_msg,
'backtrace' => wp_debug_backtrace_summary( null, 0, false ), // @codingStandardsIgnoreLine
);
wdm_log_json( $error_data );
} elseif ( ! empty( $body->exception ) ) {
if ( 'invalid_parameter_exception' === $body->exception ) {
$success = 0;
Expand Down

0 comments on commit 1b6ccf9

Please sign in to comment.