mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-20 13:59:12 +00:00
Bug fix
This commit is contained in:
parent
791182d9c4
commit
d43f759662
2 changed files with 26 additions and 8 deletions
|
@ -6,7 +6,7 @@ import 'package:sentry_flutter/sentry_flutter.dart';
|
|||
|
||||
import 'package:adguard_home_manager/models/server.dart';
|
||||
|
||||
enum ExceptionType { socket, timeout, handshake, unknown }
|
||||
enum ExceptionType { socket, timeout, handshake, http, unknown }
|
||||
|
||||
class HttpResponse {
|
||||
final bool successful;
|
||||
|
@ -73,8 +73,14 @@ class HttpRequestClient {
|
|||
statusCode: null,
|
||||
exception: ExceptionType.handshake
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
Sentry.captureException(e, stackTrace: stackTrace);
|
||||
} on HttpException {
|
||||
return const HttpResponse(
|
||||
successful: false,
|
||||
body: null,
|
||||
statusCode: null,
|
||||
exception: ExceptionType.http
|
||||
);
|
||||
} catch (e) {
|
||||
return const HttpResponse(
|
||||
successful: false,
|
||||
body: null,
|
||||
|
@ -123,6 +129,13 @@ class HttpRequestClient {
|
|||
statusCode: null,
|
||||
exception: ExceptionType.timeout
|
||||
);
|
||||
} on HttpException {
|
||||
return const HttpResponse(
|
||||
successful: false,
|
||||
body: null,
|
||||
statusCode: null,
|
||||
exception: ExceptionType.http
|
||||
);
|
||||
} on HandshakeException {
|
||||
return const HttpResponse(
|
||||
successful: false,
|
||||
|
@ -130,8 +143,7 @@ class HttpRequestClient {
|
|||
statusCode: null,
|
||||
exception: ExceptionType.handshake
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
Sentry.captureException(e, stackTrace: stackTrace);
|
||||
} catch (e) {
|
||||
return const HttpResponse(
|
||||
successful: false,
|
||||
body: null,
|
||||
|
@ -180,6 +192,13 @@ class HttpRequestClient {
|
|||
statusCode: null,
|
||||
exception: ExceptionType.timeout
|
||||
);
|
||||
} on HttpException {
|
||||
return const HttpResponse(
|
||||
successful: false,
|
||||
body: null,
|
||||
statusCode: null,
|
||||
exception: ExceptionType.http
|
||||
);
|
||||
} on HandshakeException {
|
||||
return const HttpResponse(
|
||||
successful: false,
|
||||
|
@ -187,8 +206,7 @@ class HttpRequestClient {
|
|||
statusCode: null,
|
||||
exception: ExceptionType.handshake
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
Sentry.captureException(e, stackTrace: stackTrace);
|
||||
} catch (e) {
|
||||
return const HttpResponse(
|
||||
successful: false,
|
||||
body: null,
|
||||
|
|
|
@ -265,7 +265,7 @@ class ServersProvider with ChangeNotifier {
|
|||
if (data.currentVersion == data.newVersion) {
|
||||
final gitHubResult = await ExternalRequests.getReleaseData(releaseTag: data.newVersion ?? data.currentVersion);
|
||||
if (gitHubResult.successful == true) {
|
||||
data.changelog = gitHubResult.content;
|
||||
data.changelog = (gitHubResult.content as GitHubRelease).body;
|
||||
}
|
||||
setUpdateAvailableData(data);
|
||||
timer.cancel();
|
||||
|
|
Loading…
Add table
Reference in a new issue