2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00

Catch CertificateException and HandshakeException

This commit is contained in:
Oliver 2021-10-27 19:04:28 +11:00
parent 4e22f34dd1
commit 57911136e8

View File

@ -565,6 +565,11 @@ class InvenTreeAPI {
print("TimeoutException at ${url}");
showTimeoutError();
return;
} on HandshakeException catch (error) {
print("HandshakeException at ${url}:");
print(error.toString());
showServerError(L10().serverCertificateError, error.toString());
return;
} catch (error, stackTrace) {
print("Server error at ${url}: ${error.toString()}");
showServerError(L10().serverError, error.toString());
@ -815,6 +820,16 @@ class InvenTreeAPI {
print("TimeoutException at ${url}");
showTimeoutError();
return null;
} on CertificateException catch (error) {
print("CertificateException at ${url}:");
print(error.toString());
showServerError(L10().serverCertificateError, error.toString());
return null;
} on HandshakeException catch (error) {
print("HandshakeException at ${url}:");
print(error.toString());
showServerError(L10().serverCertificateError, error.toString());
return null;
} catch (error, stackTrace) {
print("Server error at ${url}: ${error.toString()}");
showServerError(L10().serverError, error.toString());