From 57911136e88c4b9c5a50718223f23c2789c53437 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 27 Oct 2021 19:04:28 +1100 Subject: [PATCH] Catch CertificateException and HandshakeException --- lib/api.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/api.dart b/lib/api.dart index 7e751653..bd57cfb0 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -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());