From 4e22c08ed920fe08a44314f94cc324f88a9bf9b1 Mon Sep 17 00:00:00 2001 From: Hans Kokx Date: Tue, 17 Sep 2024 13:01:36 +0200 Subject: [PATCH] Add error handling to login method Signed-off-by: Hans Kokx --- .../services/authentication/authentication_service.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/src/services/authentication/authentication_service.dart b/lib/src/services/authentication/authentication_service.dart index 703fdd7..07ff758 100644 --- a/lib/src/services/authentication/authentication_service.dart +++ b/lib/src/services/authentication/authentication_service.dart @@ -186,11 +186,13 @@ class ArcaneAuthenticationService extends ArcaneService { password: password, ); - if (result.isSuccess) { - setAuthenticated(); - if (onLoggedIn != null) await onLoggedIn(); + if (result.isFailure) { + throw Exception(result.error); } + setAuthenticated(); + if (onLoggedIn != null) await onLoggedIn(); + return result; }