diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Transport/HttpTransport.cs b/clients/algoliasearch-client-csharp/algoliasearch/Transport/HttpTransport.cs index 2d64a1a511e..2634cdf68cf 100644 --- a/clients/algoliasearch-client-csharp/algoliasearch/Transport/HttpTransport.cs +++ b/clients/algoliasearch-client-csharp/algoliasearch/Transport/HttpTransport.cs @@ -223,7 +223,7 @@ private async Task ExecuteRequestAsync( } throw new AlgoliaUnreachableHostException( - "RetryStrategy failed to connect to Algolia. Reason: " + _errorMessage + "RetryStrategy failed to connect to Algolia. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support Reason: " + _errorMessage ); } diff --git a/clients/algoliasearch-client-dart/packages/client_core/lib/src/algolia_exception.dart b/clients/algoliasearch-client-dart/packages/client_core/lib/src/algolia_exception.dart index 955bbdd7ea2..8fb9847cfe4 100644 --- a/clients/algoliasearch-client-dart/packages/client_core/lib/src/algolia_exception.dart +++ b/clients/algoliasearch-client-dart/packages/client_core/lib/src/algolia_exception.dart @@ -73,12 +73,14 @@ final class AlgoliaWaitException implements AlgoliaException { final class UnreachableHostsException implements AlgoliaException { /// The list of errors associated with each unreachable host. final List errors; + final String message = + "If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support"; /// Constructs an [UnreachableHostsException] with the provided list of errors. const UnreachableHostsException(this.errors); @override String toString() { - return 'UnreachableHostsException{errors: $errors}'; + return 'UnreachableHostsException{errors: $errors, message: $message}'; } } diff --git a/clients/algoliasearch-client-go/algolia/errs/no_more_host_to_try_err.go b/clients/algoliasearch-client-go/algolia/errs/no_more_host_to_try_err.go index fdc72b9c9d5..9ac4268c5f1 100644 --- a/clients/algoliasearch-client-go/algolia/errs/no_more_host_to_try_err.go +++ b/clients/algoliasearch-client-go/algolia/errs/no_more_host_to_try_err.go @@ -22,10 +22,12 @@ func (e *NoMoreHostToTryError) IntermediateNetworkErrors() []error { } func (e *NoMoreHostToTryError) Error() string { + baseErr := "all hosts have been contacted unsuccessfully, it can either be a server or a network error or wrong appID/key credentials were used. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support" + if len(e.intermediateNetworkErrors) > 0 { - return fmt.Errorf("all hosts have been contacted unsuccessfully, it can either be a server or a network error or wrong appID/key credentials were used. %w", errors.Join(e.intermediateNetworkErrors...)).Error() + return fmt.Errorf("%s %w", baseErr, errors.Join(e.intermediateNetworkErrors...)).Error() } - return "all hosts have been contacted unsuccessfully, it can either be a server or a network error or wrong appID/key credentials were used. You can use 'ExposeIntermediateNetworkErrors: true' in the config to investigate." + return fmt.Sprintf("%s You can use 'ExposeIntermediateNetworkErrors: true' in the config to investigate.", baseErr) } func (n NoMoreHostToTryError) Is(target error) bool { diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/exceptions/AlgoliaRetryException.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/exceptions/AlgoliaRetryException.java index 05d334d36b2..8b84c932019 100644 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/exceptions/AlgoliaRetryException.java +++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/exceptions/AlgoliaRetryException.java @@ -12,7 +12,7 @@ public class AlgoliaRetryException extends AlgoliaRuntimeException { private final List errors; public AlgoliaRetryException(List errors) { - super("Error(s) while processing the retry strategy", errors.get(errors.size() - 1)); + super("Error(s) while processing the retry strategy. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support", errors.get(errors.size() - 1)); this.errors = errors; } diff --git a/clients/algoliasearch-client-javascript/packages/client-common/src/transporter/errors.ts b/clients/algoliasearch-client-javascript/packages/client-common/src/transporter/errors.ts index b109e04de00..5fa5306ccbe 100644 --- a/clients/algoliasearch-client-javascript/packages/client-common/src/transporter/errors.ts +++ b/clients/algoliasearch-client-javascript/packages/client-common/src/transporter/errors.ts @@ -43,7 +43,7 @@ export class ErrorWithStackTrace extends AlgoliaError { export class RetryError extends ErrorWithStackTrace { constructor(stackTrace: StackFrame[]) { super( - 'Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.', + 'Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support', stackTrace, 'RetryError', ); diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/exception/AlgoliaRuntimeException.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/exception/AlgoliaRuntimeException.kt index f2b72dcaab1..fd8866b1a6d 100644 --- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/exception/AlgoliaRuntimeException.kt +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/exception/AlgoliaRuntimeException.kt @@ -43,7 +43,7 @@ public class AlgoliaApiException( */ public class AlgoliaRetryException( public val exceptions: List, -) : AlgoliaRuntimeException("Error(s) while processing the retry strategy", exceptions.last()) +) : AlgoliaRuntimeException("Error(s) while processing the retry strategy. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support", exceptions.last()) /** * Exception thrown when an error occurs during the wait strategy. For example: maximum number of diff --git a/clients/algoliasearch-client-php/lib/Exceptions/UnreachableException.php b/clients/algoliasearch-client-php/lib/Exceptions/UnreachableException.php index b842080266d..526df74017b 100644 --- a/clients/algoliasearch-client-php/lib/Exceptions/UnreachableException.php +++ b/clients/algoliasearch-client-php/lib/Exceptions/UnreachableException.php @@ -8,7 +8,7 @@ public function __construct($message = '', $code = 0, $previous = null) { if (!$message) { $message - = 'Impossible to connect, please check your Algolia Application Id.'; + = 'Impossible to connect, please check your Algolia Application Id. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support'; } parent::__construct($message, $code, $previous); diff --git a/clients/algoliasearch-client-python/algoliasearch/http/transporter.py b/clients/algoliasearch-client-python/algoliasearch/http/transporter.py index b82d7aac55d..95b44fd9790 100644 --- a/clients/algoliasearch-client-python/algoliasearch/http/transporter.py +++ b/clients/algoliasearch-client-python/algoliasearch/http/transporter.py @@ -99,7 +99,7 @@ async def request( raise RequestException(content, response.status_code) - raise AlgoliaUnreachableHostException("Unreachable hosts") + raise AlgoliaUnreachableHostException("Unreachable hosts. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support") class EchoTransporter(Transporter): diff --git a/clients/algoliasearch-client-python/algoliasearch/http/transporter_sync.py b/clients/algoliasearch-client-python/algoliasearch/http/transporter_sync.py index 4d11a55e48c..5d79a3e7d3e 100644 --- a/clients/algoliasearch-client-python/algoliasearch/http/transporter_sync.py +++ b/clients/algoliasearch-client-python/algoliasearch/http/transporter_sync.py @@ -112,7 +112,7 @@ def request( raise RequestException(content, response.status_code) - raise AlgoliaUnreachableHostException("Unreachable hosts") + raise AlgoliaUnreachableHostException("Unreachable hosts. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support") class EchoTransporterSync(TransporterSync): diff --git a/clients/algoliasearch-client-ruby/lib/algolia/transport/transport.rb b/clients/algoliasearch-client-ruby/lib/algolia/transport/transport.rb index 8c190b88fc5..3519d7cbbd9 100644 --- a/clients/algoliasearch-client-ruby/lib/algolia/transport/transport.rb +++ b/clients/algoliasearch-client-ruby/lib/algolia/transport/transport.rb @@ -85,7 +85,7 @@ def request(call_type, method, path, body, opts = {}) end end - raise Algolia::AlgoliaUnreachableHostError.new("Unreachable hosts.", retry_errors) + raise Algolia::AlgoliaUnreachableHostError.new("Unreachable hosts. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support", retry_errors) end private diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/exception/AlgoliaRuntimeException.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/exception/AlgoliaRuntimeException.scala index 3572ab592a3..78f4bd3e9d4 100644 --- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/exception/AlgoliaRuntimeException.scala +++ b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/exception/AlgoliaRuntimeException.scala @@ -61,7 +61,7 @@ case class AlgoliaRequestException( case class AlgoliaRetryException( exceptions: List[Throwable] ) extends AlgoliaRuntimeException( - "Error(s) while processing the retry strategy", + "Error(s) while processing the retry strategy. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support", exceptions.lastOption.orNull ) diff --git a/clients/algoliasearch-client-swift/Sources/Core/Networking/HTTP/AlgoliaError.swift b/clients/algoliasearch-client-swift/Sources/Core/Networking/HTTP/AlgoliaError.swift index 4a7499af1dc..26986186a7d 100644 --- a/clients/algoliasearch-client-swift/Sources/Core/Networking/HTTP/AlgoliaError.swift +++ b/clients/algoliasearch-client-swift/Sources/Core/Networking/HTTP/AlgoliaError.swift @@ -25,7 +25,7 @@ public enum AlgoliaError: Error, LocalizedError { case let .httpError(error): "HTTP error: \(error)" case let .noReachableHosts(errors, exposeIntermediateErrors): - "All hosts are unreachable. " + + "All hosts are unreachable. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support " + ( exposeIntermediateErrors ? "Intermediate errors:\n- \(errors.map(\.localizedDescription).joined(separator: "\n- "))" : diff --git a/tests/CTS/client/search/api.json b/tests/CTS/client/search/api.json index 0ece918c75f..0dc964fb23d 100644 --- a/tests/CTS/client/search/api.json +++ b/tests/CTS/client/search/api.json @@ -132,17 +132,17 @@ }, "expected": { "error": { - "csharp": "RetryStrategy failed to connect to Algolia. Reason: The operation has timed out.", - "dart": "UnreachableHostsException{errors: [AlgoliaTimeoutException{error: DioException [receive timeout]: The request took longer than 0:00:05.000000 to receive data. It was aborted. To get rid of this exception, try raising the RequestOptions.receiveTimeout above the duration of 0:00:05.000000 or improve the response time of the server.}]}", - "go": "failed to do request: all hosts have been contacted unsuccessfully, it can either be a server or a network error or wrong appID/key credentials were used. You can use 'ExposeIntermediateNetworkErrors: true' in the config to investigate.", - "java": "Error(s) while processing the retry strategy\\nCaused by: java.net.SocketTimeoutException: timeout", - "javascript": "Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.", - "kotlin": "Error\\\\(s\\\\) while processing the retry strategy", - "php": "Impossible to connect, please check your Algolia Application Id.", - "python": "Unreachable hosts", - "ruby": "Unreachable hosts. Last error for %localhost%: Net::ReadTimeout with #", - "scala": "Error(s) while processing the retry strategy", - "swift": "All hosts are unreachable. You can use 'exposeIntermediateErrors: true' in the config to investigate." + "csharp": "RetryStrategy failed to connect to Algolia. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support Reason: The operation has timed out.", + "dart": "UnreachableHostsException{errors: [AlgoliaTimeoutException{error: DioException [receive timeout]: The request took longer than 0:00:05.000000 to receive data. It was aborted. To get rid of this exception, try raising the RequestOptions.receiveTimeout above the duration of 0:00:05.000000 or improve the response time of the server.}], message: If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support}", + "go": "failed to do request: all hosts have been contacted unsuccessfully, it can either be a server or a network error or wrong appID/key credentials were used. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support You can use 'ExposeIntermediateNetworkErrors: true' in the config to investigate.", + "java": "Error(s) while processing the retry strategy. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support\\nCaused by: java.net.SocketTimeoutException: timeout", + "javascript": "Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support", + "kotlin": "Error\\\\(s\\\\) while processing the retry strategy. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support", + "php": "Impossible to connect, please check your Algolia Application Id. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support", + "python": "Unreachable hosts. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support", + "ruby": "Unreachable hosts. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support Last error for %localhost%: Net::ReadTimeout with #", + "scala": "Error(s) while processing the retry strategy. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support", + "swift": "All hosts are unreachable. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support You can use 'exposeIntermediateErrors: true' in the config to investigate." } } }