mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-21 06:19:10 +00:00
Fix
This commit is contained in:
parent
565494e3f9
commit
3c42f790bd
1 changed files with 11 additions and 4 deletions
|
@ -39,10 +39,17 @@ class ApiClientV2 {
|
||||||
Future<ApiResponse> getServerVersion() async {
|
Future<ApiResponse> getServerVersion() async {
|
||||||
final result = await HttpRequestClient.get(urlPath: '/status', server: server);
|
final result = await HttpRequestClient.get(urlPath: '/status', server: server);
|
||||||
if (result.successful == true) {
|
if (result.successful == true) {
|
||||||
|
try {
|
||||||
return ApiResponse(
|
return ApiResponse(
|
||||||
successful: true,
|
successful: true,
|
||||||
content: jsonDecode(result.body!)['version']
|
content: jsonDecode(result.body!)['version']
|
||||||
);
|
);
|
||||||
|
} on FormatException {
|
||||||
|
return const ApiResponse(successful: false);
|
||||||
|
} catch (e, stackTrace) {
|
||||||
|
Sentry.captureException(e, stackTrace: stackTrace);
|
||||||
|
return const ApiResponse(successful: false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return const ApiResponse(successful: false);
|
return const ApiResponse(successful: false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue