Skip to content

Commit 2fa0389

Browse files
authored
fix(clients): link to support/help center on unreachable hosts (#5305)
1 parent 3b10b8e commit 2fa0389

File tree

13 files changed

+28
-24
lines changed

13 files changed

+28
-24
lines changed

clients/algoliasearch-client-csharp/algoliasearch/Transport/HttpTransport.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ private async Task<TResult> ExecuteRequestAsync<TResult, TData>(
223223
}
224224

225225
throw new AlgoliaUnreachableHostException(
226-
"RetryStrategy failed to connect to Algolia. Reason: " + _errorMessage
226+
"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
227227
);
228228
}
229229

clients/algoliasearch-client-dart/packages/client_core/lib/src/algolia_exception.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,14 @@ final class AlgoliaWaitException implements AlgoliaException {
7373
final class UnreachableHostsException implements AlgoliaException {
7474
/// The list of errors associated with each unreachable host.
7575
final List<AlgoliaException> errors;
76+
final String message =
77+
"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";
7678

7779
/// Constructs an [UnreachableHostsException] with the provided list of errors.
7880
const UnreachableHostsException(this.errors);
7981

8082
@override
8183
String toString() {
82-
return 'UnreachableHostsException{errors: $errors}';
84+
return 'UnreachableHostsException{errors: $errors, message: $message}';
8385
}
8486
}

clients/algoliasearch-client-go/algolia/errs/no_more_host_to_try_err.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ func (e *NoMoreHostToTryError) IntermediateNetworkErrors() []error {
2222
}
2323

2424
func (e *NoMoreHostToTryError) Error() string {
25+
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"
26+
2527
if len(e.intermediateNetworkErrors) > 0 {
26-
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()
28+
return fmt.Errorf("%s %w", baseErr, errors.Join(e.intermediateNetworkErrors...)).Error()
2729
}
28-
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."
30+
return fmt.Sprintf("%s You can use 'ExposeIntermediateNetworkErrors: true' in the config to investigate.", baseErr)
2931
}
3032

3133
func (n NoMoreHostToTryError) Is(target error) bool {

clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/exceptions/AlgoliaRetryException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class AlgoliaRetryException extends AlgoliaRuntimeException {
1212
private final List<Throwable> errors;
1313

1414
public AlgoliaRetryException(List<Throwable> errors) {
15-
super("Error(s) while processing the retry strategy", errors.get(errors.size() - 1));
15+
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));
1616
this.errors = errors;
1717
}
1818

clients/algoliasearch-client-javascript/packages/client-common/src/transporter/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class ErrorWithStackTrace extends AlgoliaError {
4343
export class RetryError extends ErrorWithStackTrace {
4444
constructor(stackTrace: StackFrame[]) {
4545
super(
46-
'Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.',
46+
'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',
4747
stackTrace,
4848
'RetryError',
4949
);

clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/exception/AlgoliaRuntimeException.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class AlgoliaApiException(
4343
*/
4444
public class AlgoliaRetryException(
4545
public val exceptions: List<Throwable>,
46-
) : AlgoliaRuntimeException("Error(s) while processing the retry strategy", exceptions.last())
46+
) : 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())
4747

4848
/**
4949
* Exception thrown when an error occurs during the wait strategy. For example: maximum number of

clients/algoliasearch-client-php/lib/Exceptions/UnreachableException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public function __construct($message = '', $code = 0, $previous = null)
88
{
99
if (!$message) {
1010
$message
11-
= 'Impossible to connect, please check your Algolia Application Id.';
11+
= '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';
1212
}
1313

1414
parent::__construct($message, $code, $previous);

clients/algoliasearch-client-python/algoliasearch/http/transporter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ async def request(
9999

100100
raise RequestException(content, response.status_code)
101101

102-
raise AlgoliaUnreachableHostException("Unreachable hosts")
102+
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")
103103

104104

105105
class EchoTransporter(Transporter):

clients/algoliasearch-client-python/algoliasearch/http/transporter_sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def request(
112112

113113
raise RequestException(content, response.status_code)
114114

115-
raise AlgoliaUnreachableHostException("Unreachable hosts")
115+
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")
116116

117117

118118
class EchoTransporterSync(TransporterSync):

clients/algoliasearch-client-ruby/lib/algolia/transport/transport.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def request(call_type, method, path, body, opts = {})
8585
end
8686
end
8787

88-
raise Algolia::AlgoliaUnreachableHostError.new("Unreachable hosts.", retry_errors)
88+
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)
8989
end
9090

9191
private

0 commit comments

Comments
 (0)