Change ip error

This commit is contained in:
problematicconsumer
2024-02-20 18:49:30 +03:30
parent 874a1af13f
commit c5a4338b41
3 changed files with 17 additions and 5 deletions

View File

@@ -129,6 +129,7 @@ class ProxyRepositoryImpl
TaskEither<ProxyFailure, IpInfo> getCurrentIpInfo(CancelToken cancelToken) {
return TaskEither.tryCatch(
() async {
Object? error;
for (final source in _ipInfoSources.entries) {
try {
loggy.debug("getting current ip info using [${source.key}]");
@@ -139,12 +140,13 @@ class ProxyRepositoryImpl
if (response.statusCode == 200 && response.data != null) {
return source.value(response.data!);
}
} catch (e) {
loggy.debug("failed getting ip info using [${source.key}]", e);
} catch (e, s) {
loggy.debug("failed getting ip info using [${source.key}]", e, s);
error = e;
continue;
}
}
throw const ProxyFailure.unexpected();
throw UnableToRetrieveIp(error, StackTrace.current);
},
ProxyUnexpectedFailure.new,
);