D5Original post
Moderator
Tried making this to handle existing sessions: Https://github.com/appwrite/appwrite/discussions/3938#discussioncomment-3746725
When using account.get() to see if there is a session or not, instead of catching the exception, it just shows unhandled exception general authorization scope in the console (not printing the error and not making what's inside catch(e)).
Here is the code used:
Dart
manageLogin() {
try{ account.get();}catch(e){ print(e);}
}Summary
Title: [SOLVED] Issue with handling unhandled exception in code
Solution: The code snippet provided is not properly handling the exception. To fix this, the code should be updated as follows:
```dart
manageLogin() async {
try {
await account.get();
} catch (e) {
print(e);
}
}
```
By adding the `async` keyword before the function declaration and `await` before the `account.get()` method, the code will properly handle the exceptions and display the error message in the console.