( 0 === count( $errors ) ) { $errors['unknown'] = __( 'An unknown error occurred in the Shopping Content Service.', 'google-listings-and-ads' ); } return $errors; } /** * Get an error message from a ClientException. * * @param ClientExceptionInterface $exception Exception to check. * @param string $default_error Default error message. * * @return string */ protected function client_exception_message( ClientExceptionInterface $exception, string $default_error ): string { if ( $exception instanceof BadResponseException ) { $response = json_decode( $exception->getResponse()->getBody()->getContents(), true ); $message = $response['message'] ?? false; return $message ? $default_error . ': ' . $message : $default_error; } return $default_error; } /** * Map a gRPC code to HTTP status code. * * @param ApiException $exception Exception to check. * * @return int The HTTP status code. * * @see Google\Rpc\Code for the list of gRPC codes. */ protected function map_grpc_code_to_http_status_code( ApiException $exception ) { switch ( $exception->getCode() ) { case Code::OK: return 200; case Code::CANCELLED: return 499; case Code::UNKNOWN: return 500; case Code::INVALID_ARGUMENT: return 400; case Code::DEADLINE_EXCEEDED: return 504; case Code::NOT_FOUND: return 404; case Code::ALREADY_EXISTS: return 409; case Code::PERMISSION_DENIED: return 403; case Code::UNAUTHENTICATED: return 401; case Code::RESOURCE_EXHAUSTED: return 429; case Code::FAILED_PRECONDITION: return 400; case Code::ABORTED: return 409; case Code::OUT_OF_RANGE: return 400; case Code::UNIMPLEMENTED: return 501; case Code::INTERNAL: return 500; case Code::UNAVAILABLE: return 503; case Code::DATA_LOSS: return 500; default: return 500; } } }
Fatal error: Trait "Automattic\WooCommerce\GoogleListingsAndAds\API\Google\ExceptionTrait" not found in /htdocs/wp-content/plugins/google-listings-and-ads/src/API/Google/AdsAssetGroupAsset.php on line 31