Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ private async Task<TResult> ExecuteRequestAsync<TResult, TData>(
}

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
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<AlgoliaException> 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}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class AlgoliaRetryException extends AlgoliaRuntimeException {
private final List<Throwable> errors;

public AlgoliaRetryException(List<Throwable> 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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class AlgoliaApiException(
*/
public class AlgoliaRetryException(
public val exceptions: List<Throwable>,
) : 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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- "))" :
Expand Down
22 changes: 11 additions & 11 deletions tests/CTS/client/search/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 #<TCPSocket:(closed)>",
"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 #<TCPSocket:(closed)>",
"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."
}
}
}
Expand Down